Config injection during packaging

Overview of how to inject information into config/ini files during packaging

Updated over 2 years ago Edit Page Revisions

Config injection during packaging

Sometimes you want to change variables in a config/ini file during packaging. This can be done by adding the following line to your build command:

-ini:<ConfigFile>:[<ConfigSection>]:SectionKey=SectionValue -SaveConfigOverrides

When injecting arrays use the following syntax:

-ini:<ConfigFile>:[<ConfigSection>]:SectionKey="{ElementKey='ElementValue';...}" -SaveConfigOverrides

Example config file

In the following examples we will use the DefaultEngine.ini file as an example. This can be changed to the another file by switching out the . You will need to not use the Default moniker.

[ExampleSection]
AVariable=OldValue
+AnArray=(FirstElement="FirstValue",SecondElement="SecondValue")

Example with single variable

RunUAT.bat BuildCookRun ... -ini:Engine:[ExampleSection]:AVariable=NewValue -SaveConfigOverrides

Example with array

RunUAT.bat BuildCookRun ... -ini:Engine:[ExampleSection]:AnArray="{FirstElement='NewValue1';SecondElement='NewValue2'}" -SaveConfigOverrides

More reading

Bryan @ Disruptive Games, Inc have a nice article on medium, which can be found here.