godot
godot copied to clipboard
Allow project settings to be overridden from command line via environment variables in debug builds
Environment variables are typically used to allow more flexible configuration handling when using the command line.
Examples:
# Force this run only to be single-threaded
GODOT_THREADING_WORKER_POOL_MAX_THREADS=1 godot args...
# Subsequent launches go back to being multithreaded
godot args...
# This will persist the environment variable until the command line session is closed
export GODOT_THREADING_WORKER_POOL_MAX_THREADS=1
# Because of the above command, all of these launches will now be single-threaded
godot args...
godot args...
godot args...
Edit: Disregard the section below, as this PR only affects debug builds. Release export templates won't be affected by this PR.
I like the idea on principle. A --set "path/to/project_setting" "value" CLI argument was also proposed at some point (this argument could be repeated on a single command line).
However, there are likely some caveats. For instance, some designated project settings should not be overriddable with environment variables or --set. This is particularly the case for project settings that could be modified by players to cheat in some way, such as gaining a visual advantage over others. (While this can be done with modified engine binaries, it still increases the amount of effort required to cheat.)
If anything, it may be better to create a list of overridable project settings, and disallow overriding any setting that is not in the list.
Should this be debug only or dev only?