Design of Lyra Settings Page

Words: 249

Introduction

In Lyra, press ESC and select OPTIONS to open the settings page W_LyraSettingScreen.

Page Analysis

W_LyraSettingScreen inherits from the C++ class ULyraSettingScreen, which is based on the GameSettings plugin’s UGameSettingScreen.

  classDiagram
    class W_LyraSettingScreen {
        +TopSettingsTabs
        +Settings_Panel
        +W_BottomActionBar
    }
    UCommonUserWidget <|-- UCommonActivatableWidget
    UCommonActivatableWidget <|-- UGameSettingScreen
    UGameSettingScreen <|-- ULyraSettingScreen
    ULyraSettingScreen <|-- W_LyraSettingScreen

The GameSettings plugin is based on the CommonUI plugin. For details, see: CommonUI Plugin in Unreal Engine

Header Tabs

The tab widget is built with a ULyraTabListWidgetBase. By defining BindWidget in C++, you can create a Blueprint widget that is accessible from C++.

cpp
1
2
UPROPERTY(BlueprintReadOnly, Category = Input, meta = (BindWidget, OptionalWidget = true, AllowPrivateAccess = true))
TObjectPtr<ULyraTabListWidgetBase> TopSettingsTabs;

In Blueprint, this widget is set to a W_HorizontalTabList, making it easy to adjust the specific style.

See also: Combining Blueprint and C++

During the page’s Construct, RegisterTopLevelTab is called to register each tab in sequence.

  • GameplayCollection
  • VideoCollection
  • AudioCollection
  • MouseAndKeyboardCollection
  • GamepadCollection

For each tab, the actual settings are read via UGameSettingScreen::GetSettingCollection.

The specific settings items depend on GameSetting’s UGameSettingCollection class.

After registration, you only need to listen for TopSettingsTabs’s OnTabSelected to switch to the selected Collection when the player selects the corresponding tab.

Page Content

This part is mainly orchestrated by the GameSettings plugin. UGameSettingScreen defines the variable Settings_Panel to mark the settings content widget.

Settings_Panel is the Blueprint W_SettingsPanel, which is based on the GameSettings plugin’s UGameSettingPanel.

The UI provides the settings item list ListView_Settings, as well as the settings item details Details_Settings.

TODO

Loading...