Hi MostHost LA,
I’m also adding a window / fullscreen option to my game right now, things I mention below may not solve your problem directly (it might even have nothing to do with your issue), however, it might serve as a checklist to see if you made the same mistake I made earlier.
- Test resolution and window mode in packaged build (not in PIE or standalone)
The important thing I found out after watching this short tutorial video: WTF Is? Fullscreen Mode in Unreal Engine 4 ( UE4 ) - YouTube
is that (around 02:57 in the video), the resolution and window mode console commands or even C++ UGameUserSettings->SetFullscreenMode() may not work properly under either PIE or Standalone.
I also experience the same thing myself, so I always test these options under packaged build.
- It’s better to use a single resolution and change the percentage instead of multiple resolutions
This may be a bug or something I did wrong, however, when I apply various 16:9 resolutions to my game with console commands:
“r.setres 640x360”
“r.setres 960x540”
“r.setres 1280x720”
'r.setres 1440x810"
“r.setres 1920x1080”
for some reason, only 1280x720 and 1920x1080 give me the correct result, the other 16:9 options result in weird UI offset. So, instead of applying multiple resolutions I use:
“r.setres 1280x720,r.ScreenPercentage 50” (640x360)
“r.setres 1280x720,r.ScreenPercentage 75” (960x540)
“r.setres 1280x720,r.ScreenPercentage 100” (1280x720)
“r.setres 1920x1080,r.ScreenPercentage 75” (1440x810)
“r.setres 1920x1080,r.ScreenPercentage 100” (1920x1080)
that way, all the resolutions are applied correctly and UI offsets properly.
- The cursor is “bounded” in a previous (smaller) resolution
This happens to me when I change from window mode to fullscreen mode with higher resolution, the cursor did not recognize the resolution has changed and was unable to move beyond the range within the previous resolution.
I need to call
PController->SetInputMode(FInputModeUIOnly());
after the resolution change to unlock the cursor. (use alt + tab to manually re-focus the packaged application also fix this issue, but it’s quite annoying for players every time they want to set a different screen mode)
That’s all the weird stuff I encounter when I try to add window / fullscreen mode to my game.
Hope this helps~