Standalone Game does not start in desired Screen Resolution

The title says it all: In the UE editor preferences I have set a screen resolution of 1280x800 for my standalone games. However, when I start the standalone game and print out the values I get from C++ GEngine->GameUserSettings->GetScreenResolution() I get a different screen resolution. Restarting the UE editor does not help.

Is this a bug or a feature?

PS: Apparently I have the same issue with “Play in new Window” setting – that screen resolution is not being used either.

2 Likes

Hey ,

So to be sure these are the steps that I took to change my screens resolution for in editor and stand alone game.

1.) In the viewport go to the arrow beside play and then select advanced settings.
2.) Go Down to the Play in New Window and Play in Stand Alone Game.
3.) I changed the both of mine to 1920 X 1080
4.) I then clicked on Set as Default at the top of this menu. There are some prompts, I chose yes to all of them
5.) I then clicked play in stand alone viewport.

I saw the screen in full screen resolution. Now i wasn’t playing in full screen it just sized up the window to match the screen size.

Tell me if these steps differ from yours.

Thanks,

2 Likes

My monitor has a resolution of 1920x1200. I run the game in a new window and print out the screen resolution via the aforementioned C++ function. This prints out 1280x720. Then I do exactly as you describe in steps 1-5, except that I have set both the “Play in New Window” as well as the “Play in Standalone Game” resolutions to 1280x800. Then I press the “Set as Default” button and confirm everything.

However, when I run the game now either in a new editor window or as standalone game the resolution returned by the C++ function differs from the resolution set in the editor settings.

Can I provide any other information for you to track down this issue?

Hey ,

I am unable to reproduce the issue you are experiencing. This seems more of a coding issue on your end.

However, a quick fix to test/work around is to go into your level blueprint.

Create a bound key, ( I used 1 and 2), and then for each key Execute a console command that sets the screen resolution.

The command for this is r.setres 1920x1080 (f for fullscreen and w for window) and set the resolution to the values you want.

Thanks,

1 Like

Hi , yes that works of course. Actually this is what I am trying to achieve. Well, in fact I don’t use the console command you mentioned but the C++ function GEngine->GameUserSettings->SetScreenResolution(). This works fine.

However, what I wanted to achieve originally (or: as well) is to set the default window size when I run the game, not the size after setting it manually.

When you say “coding issue on my end”, what do you mean exactly? What could cause this issue, i.e. override the default settings in the editor settings?

Hey ,

In order to reproduce this issue we need the code and steps that you are using to change the resolution on viewport and stand alone.

Please send me the steps you take to implement your code, your code in c++, and where you are adding this in game.

Thanks,

Hi Login, I think this is a missunderstanding. By default I do nothing in terms of chaning the resolution. I only change it via the aforementioned C++ function when the user clicks a button in our in-game settings menu.

So the issue is this: Even though we do not change the resolution “manaully”, the default settings from the editor settings are not considered when running the game standalone or in a new edtor window. Chaninging the resolution manually however in-game does work.

Hey ,

Thank you that does clarify what you are having an issue with.

As a last question before exploring code specifically, have you tried launching the game itself or packaging. This may help narrow down the possibilities of where this issue is occurring.

Thanks,

Well, as said: I tried both, launching the game in a new UE editor window, as well as launching the standalone game. The packaged version is not my concern, as I am trying to get the edtior settings to work…

Hey ,

There is a play function and a launch function. I apologize for the confusion.

As a troubleshoot I would like for you to create a blank project and add a sphere or cube to the level.

Then please follow these steps,

1.) In your main viewport next to the play arrow click the drop down arrow
2.) Go to advance settings.
3.) Go to stand alone game and change the width and height to what you want.
4.) Do not change from common window size.
5.) Save the project.
6.) Play in stand alone game.

With this I can attempt to narrow the issue down to a project specific issue or if indeed there is an issue with UE4 itself.
This will also allow me to test with your specs on your OS.

Thanks,

2 Likes

Sounds like a plan! One question though: Is there any way to retrieve the current viewport size in pixels via a console command, or do I need to call that C++ function?

I just found out that when I set the desired screen resolution directly in the GameUserSettings.ini file and then start the game, it works! So apparently the editor default settings are not written to the project ini file?!

Hello ,

Whenever you package your project out those settings are written to that package and will be called upon play.

The editor settings inside of the advanced settings, mentioned in the previous post will never change because they are editor specific. They require that the editor be open to function.

I was never able to reproduce this issue internally. I am glad that you found a solution.

Thanks,

Wait, this seems to be exactly the problem I am working right now. Those settings are not being copied to the packaged game. When I package it no ini file at all is there, nor any “Saved” or “Config” folders. The packaged game always starts in the default screen resolution, regardless of any ini file I put there.

Actually I have created a new question here, because the problem seems to be related to the packaged game, in which I cannot save the UserGameSettings to the ini file.

Could you please have a look here? I am totally out of ideas :frowning:

Ok,

Here is a troubleshoot for that.

(I recommend making a copy for this)

1.) Delete your config, intermediate, and saved. ( Make sure your editor is not open)

2.) Open your project again.

3.) Save

4.) Package your project again

Sometimes whenever you change .ini files they do not update unless you delete them.

I believe this is an issue that is currently being looked into.

Thanks,

Well, my problem is that settings are not being saved to the ini file in the packaged game. So I did as you suggested, and I also deleted the whole %LOCALAPPDATA%/ folder. Then I started the packaged game again and it indeed took the default settings I had set in my project.

But: After changing the settings in-game, and saving them as described in the other thread, the %LOCALAPPDATA%/[APP-NAME]/Saved/Config/WindowsNoEditor/GameUserSettings.ini file is just empty!

So how do I correctly save the settings to the ini file from in-game?

Hey ,

I have forwarded this issue to the platform team. They are responsible for any after editor issues.

This is, perhaps, an issue that is being currently looked into on their end.

Thanks,

Hi ,

You will need to enter your resolution settings in your games.

GAMENAME/Config/DefaultGameUserSettings.ini file

^ please note, this is not a saved directory.

If one does not exist, create one. The issue you are seeing is that you are making an editor change, and that is not for games. The changes you make in editor will be put into EditorPerProjectUserSettings.ini, and this is not used on Games, instead it is used when the editor deploys a game instance.

Hope this resolves your issue.

/

1 Like

Ok thanks for your feedback. In that case the edtior settings names are quite misleading :slight_smile:

Yes I know that, thanks. But I was looking for a non-hardcoded way of achieving it for PIE, and I was assuming that is the very reason for these settings in editor settings.