Console Variables
Create console variables in Blueprint to define custom game settings that integrate with Unreal Engine's console system.
Overview
AutoSettings extends Unreal Engine's console variable system with Blueprint support. Console Variables work with the core setting framework using Blueprint classes:
- Console Variable Blueprints - Blueprint classes that define console variables (Boolean, Integer, Float, String)
- Automatic Registration - Console variables are auto-discovered at startup, no manual registration code required
- OnChanged Event - Implement to respond when values change from console, config, or settings UI
- Engine Integration - Built on Unreal's native
IConsoleVariablesystem
For C++ projects, use Unreal's native console variable system directly instead of Blueprint console variables.
Console Variable Types
| Type | Blueprint Class | Use Cases | Examples |
|---|---|---|---|
| Boolean | ConsoleVariable Boolean | Feature toggles, on/off settings | game.ShowSubtitles, r.VSync |
| Integer | ConsoleVariable Integer | Discrete levels, enumerated values | sg.OverallScalability, game.DifficultyLevel |
| Float | ConsoleVariable Float | Continuous ranges, percentages | game.MasterVolume, game.MouseSensitivity |
| String | ConsoleVariable String | Text values, language settings | game.Language, ui.Theme |
For Integer and Float types, use the Clamp node in OnChanged events to validate ranges and prevent invalid values.
Creating a Console Variable
Step 1: Create the Blueprint Class
- Right-click in Content Browser → Blueprint Class
- Search for parent class: Type
ConsoleVariable - Choose the appropriate type from the table above
Step 2: Configure Class Defaults
Open your Blueprint and set the Class Defaults:
- Name: The console variable name (e.g.,
"game.MasterVolume") - Default Value: Starting value when no config exists
- Help Text: Description shown in console help
Example:
Name: "game.MasterVolume"
Default Value: 1.0
Help Text: "Master volume multiplier (0.0 to 1.0)"
Use a prefix to group related settings (e.g., game.* for gameplay, audio.* for audio, ui.* for interface). Avoid spaces and special characters.
Step 3: Implement OnChanged Event
- Switch to Event Graph
- Add Event: Right-click → Add Event → Event On Changed
- Implement your logic: What should happen when the value changes
Example:
The example project uses a more complete implementation with Push Sound Mix Modifier and Set Sound Mix Class Override for proper audio mixing.
Your console variable is automatically registered and can be tested in the console or used in settings menus via the Console Variable Application Strategy.
Testing Console Variables
Press ~ (tilde) to open the console and test your console variable:
game.MasterVolume // Show current value
game.MasterVolume 0.5 // Set new value
game.MasterVolume ? // Show help text
Add logging to OnChanged events for debugging:
See the example project for a complete implementation.