I want to apply certain settings automatically as soon as the game is launched, and to that end I’ve tried making use of the event Init on a custom GameInstance. If I do something as simple as: Event Init -> Execute Console Command: r.setRes 1920x1080f
It seems to do absolutely nothing. Other things seem to work (like doing saving and loading to slots and such), but executing the above command does not seem to work. I presume (and do tell me if I am wrong) part of this is related to certain graphics functionality not finishing its loading until some point after GameInstance starts running.
I could probably use other solutions (i.e. having an intermediate level whose sole purpose is to apply these settings and so on), but - in theory at least - using a GameInstance should make it consistently be triggered on game startup and only on game startup. I’m mainly interested in solving this within the GameInstance itself rather than using other alternatives.
Could anyone explain to me why this is happening? Is there an actual blueprint solution without using special plugins, or am I forced to go the route of plugins for this to work?
I personally execute this command in the gamemode, after beginplay. this might be the problem in your case. Also I know there is a second console command to use for fullscreen, wich can be 0, 1 or 2. To tell the game wether you want windowed fullscreen, borderless fullscreen or fullscreen when entering fullscreen mode.
I also use wf, instead of f. to get borderless windowed fullscreen so I do not need that second console command.
try playing around with it or executing it in gamemode too.
edit: “r.FullScreenMode 1” should be executed before setres.
Whilst I’m sure I’ll create a fully featured options menu later on with support for windowed fullscreen and such later on, for the prototyping right now I’m deliberately just using two resolutions (1280x720w and 1920x1080f) to build the basic functionality for setting and saving options and such. I did however try to put an extra console command node in the GameInstance, like this: Event Init -> Execute Console Command: r.FullscreenMode 0 -> Execute Console Command: r.setRes 1920x1080f
Still not working. For the record, using the very same command (r.setRes 1920x1080f) in an UMG menu inside the game works perfectly. Game goes to fullscreen just like expected. It’s just the initial startup from GameInstance that fails.
It is a possibility to use a GameMode if nothing else works, but I’m trying to avoid it. Still interested in finding out the why’s (and how’s) regarding GameInstance and graphics options.
EDIT: Just to make sure it wasn’t something with my project, I created a completely new, blank blueprint project on 4.10.4 which consists of nothing but a new game instance containing just the setres command. Doesn’t work there either. Must mean that I either can’t set the screenmode/resolution in the GameInstance, or there are some steps I must do first that I do not know about.