Can't increase screen resolution without application reboot

I have a function changing screen resolution:

void AMainGameMode::SetNewResolution(FIntPoint NewResolution)
{
	if(!GEngine) return;
	
	UGameUserSettings* GameSettings = GEngine->GetGameUserSettings();
	GameSettings->SetScreenResolution(NewResolution);
	GameSettings->ApplySettings();
}

It works only in one case: if current screen resolution is bigger than NewResolution argument. But it doesn’t change resolution if NewResolution is bigger. E.g. I can’t change resolution from 1024x768 to 1280x720, the screen blinks once but stays the same. Also, there are new ResolutionSizeX and ResolutionSizeY in GameUserSettings.ini so when I restart application new resolution is applied. But it doesn’t change during runtime.

When I tried to change from 1024x768 to 1920x1080 it failed as usual, Log says:

[2014.08.08-00.14.18:905][366]LogConsoleResponse:Display: 
[2014.08.08-00.14.18:944][366]LogRenderer:Warning: Reallocating scene render targets to support 1920x1080.
[2014.08.08-00.14.19:245][366]LogRenderer:Warning: Reallocating scene render targets to support 1040x784.
[2014.08.08-00.14.22:048][367]LogRenderer:Warning: Reallocating scene render targets to support 1024x768.

Nothing informative. It just changes resolution back to original.

UEngine ver. 4.3

That sounds like a bug, but you could try the console command:

 if (GEngine)
 {
     GEngine->Exec(GetWorld(), TEXT("r.SetRes 1920x1080"));    
 }

Actually SetScreenResolution() sets r.SetRes. So it won’t help.

I also think it’s a bug because even ShooterGame can’t increase screen resolution without app reboot.
I guess I’d better edit the question.

I found a solution for UE 4.4.0:

GameSettings->SetScreenResolution(NewResolution);
GameSettings->SetFullscreenMode(EWindowMode::Windowed);
GameSettings->ApplySettings(false);
GameSettings->SetFullscreenMode(EWindowMode::Fullscreen);
GameSettings->ApplySettings(false);

Now resolution changes as it should but after increasing the resolution the mouse cursor is locked to rectangle area of previous resolution. It unlocks if change focus to another window or toggle console though. Now I just need to find a way to unlock it by code.

UPDATE: It was simple. You just need to run FSlateApplication::Get().LockCursor(NULL) and it unlocks cursor.

I would also like to bring this “mouse lock” bug to more attention.

I use Blueprint for my project and it seems though through C++ there is a way around this problem where the mouse locks to the previous resolution. In Blueprints there is no solution that I can find.

So, currently, lets say I have 720p res and in my menu I pick 1080p res, now the mouse is still locked to a 720p frame. So, now I can’t reach a bunch of menu items with the mouse. Basically you get stuck in the menu because the mouse can’t reach an area where the next button is. It’s a pretty bad bug in that sense.

4.5-preview ruined this workaround for Editor Standalone mode. Only packaged game and Launch work but they start much longer than Standalone mode.

Also it’s now impossible to use this workaround in GameMode BeginPlay() function like I use it for init user settings. Have to move it to the very first Tick event of Game Mode. But it’s another workaround.

I hope it’s just preview issues and everything will be back at least to 4.4 behavior. But still… Come on, guys! This problem exists since the year one. And it’s not something small like typo in editor GUI. It’s a serious issue. Is there any progress in fixing it?

hmmm we also got problem on this issue for quite awhile too. Any update on the solution?

Best,

Nope… 4.6 still has this bug. Seems like Epic don’t give a ■■■■ about that. They didn’t even show up here, in this topic.

Hi everyone,

Sorry for the delay in responding to this issue. I attempted to reproduce this using 4.5.1 and 4.3.1, both built from source code, and was unable to do so. I copied the code in the function posted above and set it to be called with a button press. Then I packaged the game for Windows and ran the resulting executable. Pressing the button that called the function to increase the resolution resulted in the window immediately increasing in size. The corresponding lines in the log:

[2014.11.26-16.46.03:877][177]LogConsoleResponse:Display: 
[2014.11.26-16.46.03:933][177]LogRenderer:Warning: Reallocating scene render targets to support 1920x1080.

The log then immediately went into a display benchmark test.

Could you provide some more information about how you are setting this up that would help me to be able to see the same results that you are seeing?

Try that in fullscreen mode, . Windowed mode works fine.

Here’s a video. - YouTube

I created a C++ 3rd person project, added function to change resolution and set button 1 for 1920x1080 and button 2 for 1280x720.
As you can see in video it changes fine to smaller size (1080p to 720p) but it fails visa versa (r.SetRes show 1920x1080f but the screen size is still 720p).
Then I entered windowed mode (ALT+Enter) and back to fullscreen and screen became 1080p (that’s 0:36 on video, you can’t see window because nvidia shadowplay shows only window contents).

I just tried again in fullscreen mode, but still was unable to reproduce the issue. Would you be able to zip up your test project and upload it so I can take a look?

Of course. Here you go.
https://www.sendspace.com/file/phnr4w

Also you can try to set r.SetRes in fullscreen mode to something like 1024x768 and then to 1920x1080 and you can see that r.SetRes changes but the actual resolution doesn’t.

I downloaded the project you provided and ran some tests with it, and it mostly worked normally for me. The only time I started seeing something similar to what you described was when I tried to set the game’s resolution to a value higher than my monitor could support.

The highest resolution my monitor can support is 1920 x 1080. When I tried changing the resolution to 2048 x 1152 in fullscreen mode, the resolution was instead set to 1920 x 1080. In windowed mode, it would get set to 2048 x 1152. I cannot say for sure if this may be what is happening in your case (it doesn’t really sound like it), but I am curious to find out what is the maximum resolution setting your monitor will support.

My monitor is FullHD. But I can’t change from 720p to 1080p unless I go windowed mode and back to fullscreen after that. I got curious why it worked for you and tried my iMac as a display to be sure resolution limit is not the case. No luck.

I added log to my function:

void ATestResolutionGameMode::SetNewResolution(FIntPoint NewResolution)
{
	if(!GEngine) return;

	UGameUserSettings* GameSettings = GEngine->GetGameUserSettings();
	UE_LOG(LogTemp,Warning,TEXT("Setting new resolution: %s"),*(NewResolution.ToString()));
	GameSettings->SetScreenResolution(NewResolution);
	UE_LOG(LogTemp,Warning,TEXT("New resolution set: %s. Applying settings..."),*(GameSettings->GetScreenResolution().ToString()));
	GameSettings->ApplySettings(false);
	UE_LOG(LogTemp,Warning,TEXT("Applied."));
}

And run the project. What I have in log:

[2014.12.02-20.10.20:592][  0]LogWorld: Bringing up level for play took: 0.001562
[2014.12.02-20.10.20:593][  0]LogInit:Display: Game Engine Initialized.
[2014.12.02-20.10.20:815][  0]LogLoad: Full Startup: 11.66 seconds (BP compile: 0.11 seconds)
[2014.12.02-20.10.20:895][  2]LogRenderer:Warning: Reallocating scene render targets to support 1280x720.
[2014.12.02-20.10.23:309][118]LogConsoleResponse:Display: 
[2014.12.02-20.10.25:750][267]LogTemp:Warning: Setting new resolution: X=1920 Y=1080
[2014.12.02-20.10.25:750][267]LogTemp:Warning: New resolution set: X=1920 Y=1080. Applying settings...
[2014.12.02-20.10.25:780][267]LogRenderer:Warning: Reallocating scene render targets to support 1920x1080.
[2014.12.02-20.10.25:780][267]LogConsoleResponse:Display: 
[2014.12.02-20.10.25:780][267]LogTemp:Warning: Applied.
[2014.12.02-20.10.25:833][267]LogRenderer:Warning: Reallocating scene render targets to support 1296x736.
[2014.12.02-20.10.26:005][268]LogRenderer:Warning: Reallocating scene render targets to support 1280x720.
[2014.12.02-20.10.30:678][553]Closing by request

it changes back to 720p by itself after applying the settings.

I added the log output that you included, and these were the results I received when trying to set the higher resolution to 2048x1152 (it worked normally when setting the higher resolution to 1920x1080).

The game started initially in full-screen mode at 1600x900. I then switched to 1280x720, which worked fine. I then switched to 2048x1152, which was done and then immediately reset to 1920x1080 (my maximum monitor resolution).

At this point I switched to windowed mode and the resolution changed back to 2048x1152. Switching to 1280x720 and back to 2048x1152 worked normally here.

Switching back to fullscreen mode immediately reset the resolution back to 1920x1080. I did a little checking, and in my case this is to be expected since the Engine cannot render a higher resolution in fullscreen mode than the monitor is capable of displaying. If your monitor is capable of rendering FullHD, then it should work normally up to 1920x1080. Would you be able to provide your dxdiag information, in particular your exact monitor model? We would like to try to rule out any possible hardware conflict.

Here’s my dxdiag

That’s my TV via HDMI which I use for testing. iMac via Displayport doesn’t work too (it’s capable of 2560x1440 but fails to change from 720p to 1080p, too). It’s really strange. It looks like engine doesn’t know that my monitor is capable of higher resolution unless I set it via workaround.

I tried to get my monitor native resolution by using the code:

FDisplayMetrics DisplayMetrics;
FDisplayMetrics::GetDisplayMetrics(DisplayMetrics);
FMonitorInfo PrimaryMon = DisplayMetrics.MonitorInfo[0];
UE_LOG(LogTemp,Warning,TEXT("Primary display native resolution: %ix%i"), PrimaryMon.NativeWidth,PrimaryMon.NativeHeight);

and it showed me:

[2014.12.03-03.08.50:734][340]LogTemp:Warning: Primary display native resolution: 1920x540

That’s… surprising.

UPDATE: iMac show everything right:

[2014.12.03-03.18.16:537][204]LogTemp:Warning: Primary display native resolution: 2560x1440

Sorry for the delay. I was able to get a test performed with the project you provided, using a 4K television. The resolution changes worked fine there. Unfortunately that does not completely rule out a hardware problem, but it does potentially reduce the scope of the issue if it is a hardware problem.

We are still looking into this, and certainly appreciate any and all information anyone who has experienced this issue can provide.

FSlateApplication::Get().LockCursor(NULL) doesn’t work since UE 4.11. You can avoid this bproblem by using FSlateApplicationBase::Get().GetPlatformCursor()->Lock( nullptr ); instead of.