Daily Unreal Column #22 - Developer settings
A trivial way to create your own global project settings accessible in the editor.
If you are an Unreal Engine user, changes that you haven't ever opened Project Settings are close to 0. Creating your own page with settings specific to your game or tool couldn't be any easier thanks for UDeveloperSettings
class. All it takes is to create a subclass of it and defining which config should be used to store properties. Please note that UDeveloperSettings
class is in a DeveloperSettings
module, meaning you need to add a module dependency to your *.Build.cs
file.
The most common configs used are:
Game
Engine
Editor
Input
Here is an example:
UCLASS(Config=Game)
class MYGAME_API UMyGameSettings : public UDeveloperSettings
{
GENERATED_BODY()
public:
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Config)
bool bMyAwsomeBool = false;
};
Please note that the bMyAwesomeBool
property is also marked as Config
. This ensures that this property is going to be appended to the appropriate .ini
file.
Accessing your developer settings is as simple as calling:
const UMyGameSettings* Settings = GetDefault<UMyGameSettings>();
.
.
.