Drivers
A driver is how a setting reaches the game: the plugin's own drivers set the window mode, the scalability groups, the camera's field of view, the sound classes... A setting of yours can be connected to your game in four ways, from the simplest:
| Binding | What happens | Use it for |
|---|---|---|
bind store (the default) | The value is stored and saved; your game reads it (Get Setting, On Setting Changed) | Anything your code already reads at the right time |
bind cvar <name> | The value writes a console variable | Engine or game variables |
bind reflect "<class>" get <Getter> set <Setter> | The plugin calls a getter and a setter (UFUNCTIONs) of one of your subsystems | Blueprint-friendly, no C++ registration |
bind driver <name> | Your C++ driver reads and applies the value, and can hide or gray the setting | Full control: availability, reasons, options known at run time, per player |
With a binding other than store, the plugin reads your game's value as the setting's default (when the recipe gives none), applies the player's choice at startup and on every change, saves and exports it, and reads it again to notice changes made outside the menu.
bind reflect (no C++ registration)
page gameplay {
choice difficulty "Difficulty" {
bind reflect "/Script/MyGame.MyGameSettingsSubsystem" get GetDifficulty set SetDifficulty scope gameinstance
options { easy "Easy"; normal "Normal"; hard "Hard" }
}
}scope says where the subsystem lives: engine, gameinstance, localplayer (each split-screen player then has their own value) or world. Extra param=value fill other parameters of the setter. Only your project's own recipes may use reflect; recipes from mods may not.
A C++ driver
Implement INeoNeo):
#include "NeoSettingsDriver.h"
// A recipe binds a setting to it like to a built-in driver:
// choice difficulty "Difficulty" { bind driver mygame.difficulty; options { easy "Easy"; normal "Normal"; hard "Hard" } }
class FMyDifficultyDriver : public INeoSettingsDriver
{
public:
virtual FName GetName() const override { return TEXT("mygame.difficulty"); }
virtual FNeoSettingsValue Read(const FNeoSettingsDriverContext& Context) const override
{
// The game's current value: the setting's default when the recipe gives none.
FNeoSettingsValue Value;
Value.Type = ENeoSettingsValueType::String;
Value.String = Difficulty;
return Value;
}
virtual bool Apply(const FNeoSettingsDriverContext& Context, const FNeoSettingsValue& Value) override
{
if (Value.Type != ENeoSettingsValueType::String)
{
return false; // refused: the menu shows Read again
}
Difficulty = Value.String; // apply it to your game here
return true;
}
virtual FText GetDisabledReason(const FNeoSettingsDriverContext& Context) const override
{
// Not empty: the row is grayed with this reason.
return bInMission ? NSLOCTEXT("MyGame", "DifficultyLocked", "Change the difficulty between missions.") : FText::GetEmpty();
}
private:
FString Difficulty = TEXT("normal");
bool bInMission = false;
};Register it from your module (or later: settings bound to a name nobody registered yet stay stored and are applied when it arrives):
class FMyGameModule : public FDefaultGameModuleImpl
{
public:
virtual void StartupModule() override
{
// Settings bound to the name before it is registered stay stored and are applied when it arrives.
NeoSettingsRegisterDriver(MakeShared<FMyDifficultyDriver>());
}
virtual void ShutdownModule() override
{
NeoSettingsUnregisterDriver(TEXT("mygame.difficulty"));
}
};| Function | Called | Return |
|---|---|---|
GetName | Once | The name recipes bind to: your game's prefix and a dot (mygame.) |
Read | At startup, and again to notice outside changes | The game's value (Type None when unknown) |
Apply | At startup and on each change | false when the game refused the value (the menu shows Read again) |
IsAvailable | When the menu is built | false hides the settings bound to it (feature absent on this platform) |
Get | When the menu is built | A reason grays the setting ("Change the difficulty between missions.") |
GetOptions | For options from <driver name> | The options of a choice known at run time |
IsPerPlayer | Once | true: applied for each local player (Context.), again when the player's controller changes; each split-screen player keeps their own value |
IsEditorSafe | Once | true: applied in Play In Editor while Editor Apply is Safe Only |
EndBatch | After a batch of Apply calls (startup, a preset, an import) | Apply costly changes once here |
Values use the setting's type: Bool for a toggle, Number for a slider, String (the option id) for a choice. Context. reads the binding's parameters (bind driver mygame.). Drivers run on the game thread.
In the editor. The Setup tab and the Project Settings preview draw the menu with the same drivers and no game running: IsAvailable, Get, Read and GetOptions may be called with no game world and a null Context., before your subsystems exist. Answer what you can without them, and return Type None from Read when you cannot. Apply is never called there.
Replacing a built-in driver. Registering a driver under a built-in name (camera.fov...) replaces it, with a warning in the log; unregistering it gives the built-in back.
Then in a recipe
page gameplay {
section difficulty "Difficulty" {
choice difficulty "Difficulty" {
bind driver mygame.difficulty
options { easy "Easy"; normal "Normal"; hard "Hard" }
}
}
}Known issue in this version: the recipe check knows only the plugin's drivers, so the Message Log reports this line as warning HS412 ("unknown driver") at each load. The setting works once your driver is registered (it stays hidden, its saved value kept, until then).
See Recipes for every built-in driver and binding.
Something not as described? Every code the editor shows has its own entry in Troubleshooting.