How to change console variable duraing cooking?

Hi Early,

You are correct, currently (and up to UE 5.6) the Cook Commandlet does not tick Deferred Commands, which prevents it from processing the ExecCmds from the commandline. I checked other commandlets as well, and most of them don’t tick Deferred Commands either (although a few of them do). This is likely to keep the behavior of commandlets more controlled and predictable, since ExecCmds could possibly be used to perform unrelated tasks. If you need ExecCmds, you can try creating your own commandlet based on the Cook Commandlet, or add that call if you are building the engine from source.

Now, if all you need is to set one or more CVars for the Cook Commandlet, there are some other ways to achieve that, although they are all related to specifying them on one of the following INI files (ordered below by priority):

a) File [<PROJECT_PATH>/Config/DefaultEngine.ini], section [SystemSettings]

b) File [<PROJECT_PATH>/Config/DefaultEngine.ini], section [ConsoleVariables]

c) File [<PROJECT_PATH>/Config/DefaultEditor.ini], section [ConsoleVariables]

d) File [<ENGINE_PATH>/Config/ConsoleVariables.ini], section [Startup]

e) User-specified [ConsoleVariables.ini] file, section [Startup]

Note that CVars specified in the Engine or Editor configuration files have a lower priority than CVars specified in ConsoleVariables.ini. This is important when setting “r.DumpShaderDebugInfo” because it is specified as “2” in the default ConsoleVariables.ini file. So, you would need to comment it there for your settings to have any effect. You can inspect how CVars are being set and overriden by adding -LogCmds=“LogConsoleManager VeryVerbose, LogConfig VeryVerbose” to your commandline, then examining the log file for lines from the “LogConfig” and “LogConsoleManager” categories.

You can also pass ini-based CVars on the commandline with the following syntax:

-ini:Engine:[SystemSettings]:r.DumpShaderDebugInfo=1 -ini:Engine:[ConsoleVariables]:r.DumpShaderDebugInfo=1 -ini:DefaultEditor:[ConsoleVariables]:r.DumpShaderDebugInfo=1Passing the CVars as above should work exactly like adding them to the respective ini files.

Finally, if you want to avoid having to edit the default ConsoleVariables.ini file, you can provide your own file (option ‘e’ above) containing overrides for its settings. This is the approach I would recommend:

-CVarsIni="<PATH>/<FILENAME>.ini"The path above must be either absolute, or relative to the engine binary, i.e. “../../../Engine/Config/MyConsoleVariables.ini”. If you provide a file in that manner, the default ConsoleVariables.ini will be processed first, then your custom file will have an opportunity to override them. For this to work, all CVars should go into the [Startup] section:

`; MyConsoleVariables.ini

[Startup]
r.DumpShaderDebugInfo=1`I hope this is helpful. Please let me know if this solution works for you.

Best regards,

Vitor