A settings screen
This guide makes a settings screen with two kinds of setting: a mouse sensitivity, kept in the
player's save, and the window mode, which lives in the engine's user settings. Gantry keeps the
values, the changes and the saving; your widget shows them. The example project's
Yardrush/Settings folder has a complete one: pages, settings, and WBP_YR_Settings.
1. A setting that needs no code
- Content Browser > Add > Miscellaneous > Data Asset, choose Gantry Settings Page, and
name it
SP_Controls. Set its Title to "Controls". - In Settings, add a Number Setting. Set Id to
MouseSensitivity, Display Name to "Mouse sensitivity", Minimum 0.1, Maximum 5, Step 0.1, and a Default of 1.
With nothing overridden, the value is kept in the player's save under its Id. Your game reads it with Get Saved Value on the player's registry, or from the setting itself.
2. A setting that drives the engine
- Create a Blueprint class of Choice Setting,
BP_Setting_WindowMode. - Fill its Options: Fullscreen, Windowed Fullscreen, Windowed.
- Override Read Value to return the current window mode from the engine's user settings, and Write Value to set it.
- Turn on Applies User Settings (the engine's user settings are applied and saved when the player applies) and Needs Video Confirm, because this one changes the display.
- Add it to a second page,
SP_Video.
3. Give every player the pages
In Project Settings > Plugins > Gantry Settings > Pages, add SP_Controls and SP_Video.
Every local player now has them, with saved values loaded before any menu opens.
An experience can add more with an Add Settings Pages stage while it is active: a mode's own options, or a DLC pack's.
4. The screen
Create WBP_Settings. In it:
- Get Gantry Settings with Get Owning Player: this player's registry.
- Get Pages, and make a tab per page from its Title.
- For the shown page, take its settings and make a row widget for each. Cast to the shape (Number Setting, Choice Setting, Toggle Setting, Action Setting) to choose the control: a slider, a rotator, a check box, a button.
- Have each control set the value: Set Value on a number, Set Selected Index on a choice. The game reflects the change at once.
- Ask each setting for Get Edit State to hide or disable its row, and refresh when the registry's On Setting Changed fires, since one setting can change another's state.
- An Apply button calls Apply Changes; a Revert button calls Revert Changes. Has Unapplied Changes says whether either should be enabled.
5. Keeping a display change
After the window mode changes, the registry waits for the player to keep it. While Is Awaiting Video Confirm is true, show "Keep these settings?" with the seconds from Get Video Confirm Seconds Left, and a button that calls Confirm Video Changes. Left alone for Video Confirm Seconds (Project Settings > Plugins > Gantry Settings), the display goes back by itself.
Next
- Hide or disable settings with Conditions: while another setting has some value, on some platforms, or for every split-screen player but the first.
- Let players rebind keys: the Add Input Mappings stage registers its mappings for rebinding, and a Key Binding setting edits one.