The engine configuration file (*.cfg) is an XML file that stores all global engine-related and project-related settings. These settings are read by the engine on the application start-up and used for engine initialization. By default, the configuration file unigine.cfg is created automatically on project creation.
A path to the configuration file is set by using the -engine_config command-line option on the application start-up.
- If the -project_name CLI option is set, the project folder in the User profile will be checked first for the configuration file. At that, only the name of the specified file will be checked. For example, if you run the application as follows: The engine will check the engine.cfg file in the following folder:
bin/main_x86d.exe -project_name "my_project" -engine_config "configs/engine.cfg"
- On Windows, C:/Users/<username>/my_project/
- On Linux, /home/<username>/.my_project/
- Then the specified path to the configuration file will be checked relative to the binary executable.
- Then the path to the configuration file will be checked relative to the data_path.
- Next the path to the configuration file will be checked relative to the first sub-folder of the data folder (for example, it is the data/unigine_project/ folder for projects created via UNIGINE SDK Browser).
- If the configuration file isn't found, the engine will try to create a default file relative to the binary executable or in the project folder specified in the -project_name. This default configuration file will contain renderer settings.
Configuration File Format#
The configuration file has the following format:
<config version="2.2.1"> <item name="option_name" type="option_type">option_value</item> ... <item name="option_name" type="option_type">option_value</item> </config>
Each item corresponds to one setting:
- option_name - a name of the engine-related and project-related setting. It is the same as a name of the corresponding console variable.
- option_type - a type of the setting: bool, int, float, string.
To read values from the configuration file and write them back, use functionality of the Config class. Use the appropriate methods depending on the type of the target item.
Setting Startup Options via Configuration File#
The application start-up options can be set via both the command-line and the configuration file.
The CLI options specified on the application start-up always take precedence over the ones stored in the configuration file. Some of the CLI options can be changed through the console, so they are automatically stored in the configuration file (this way, after the application is quit, they will be restored on the next start-up). However, there are command-line options that don't change the configuration file, namely:
For example, if you specify the -video_app command-line option on the application start-up, the corresponding setting video_app in the configuration file will be ignored.