What is the proper way to execute console commands in shipping build?

Currently i use:


LocalPlayer->ConsoleCommand(TEXT("r.MaxAnisotropy " + FString::FromInt(16)));

and it works great in shipping build but i heard/presume this is not the proper way to execute a command.
I’ve been looking at this; https://docs.unrealengine.com/latest/INT/Programming/Development/Tools/ConsoleManager/index.html
it says to use something like this:



IConsoleManager::Get().RegisterConsoleVariable(TEXT("r.MaxAnisotropy"),
   16,
   TEXT("Helper message.
"),
   ECVF_Scalability | ECVF_RenderThreadSafe);


but it doesn’t work for some reason? would someone be able to fix the above or is my current way fine.


LocalPlayer->ConsoleCommand

1 Like

hey dude,

usually changing config variables with console commands are A way to go like you do currently.

However, fmpov this can be considered the hard-hacky way or force something to change. I guess during development this is fine, as you are able to change those cvars inside a console during runtime.
GConfig->Flush(*configFilePath); is a way i believe which could “fix” the problem as it will write your cvars to config and applies them, too.

UGameUserSettings provided by the engine is a class where you can change scalability settings, resolution and some other stuff.
I used this class for changes as it provides some security.

Unfortunately, this class does not provide any scalability settings on the “r.” layer, except the resolution. You can only change the scalabilitygroups inside of this class.
For me i havnt been able to find a way without console commands to enter specific r. values inside a scalabilitygroup (sg.)

Maybe, someone else could give a hint for this.