メインコンテンツまでスキップ

オプションメニューの概要 - クラウドセーブ - (Unreal Engine モジュール)

Last updated on June 12, 2024

What's on the menu

In this tutorial, you will learn the components available on the Byte Wars options menu. The options menu provides a basic user interface (UI) to change the music and sound effects (SFX) volume of the game. The options menu is available in the Resources section and consists of the following files:

  • OptionsWidget: A C++ class where the options menu functionalities are defined.

    • Header file: /Source/AccelByteWars/Core/UI/MainMenu/HelpOptions/Options/OptionsWidget.h
    • CPP file: /Source/AccelByteWars/Core/UI/MainMenu/HelpOptions/Options/OptionsWidget.cpp
  • W_Options: A widget Blueprint created using Unreal Motion Graphics (UMG). Its parent class is the OptionsWidget class. You can find this Blueprint in /Content/ByteWars/UI/MainMenu/HelpOptions/Options/W_Options.uasset.

Take a look at W_Options. In the Unreal Editor, open the file, and you should see the game options like the image below.

Game options Unreal Byte Wars cloud save

As you can see from the image, the options menu has two sliders to configure the music and SFX volumes and a checkbox. Ignore this checkbox for now, as it is not related to this module. Here are the declarations of those sliders:

private:
UPROPERTY(BlueprintReadOnly, meta = (BindWidget, BlueprintProtected = true, AllowPrivateAccess = true))
UOptionListEntry_Scalar* W_OptionMusicVolumeScalar;

UPROPERTY(BlueprintReadOnly, meta = (BindWidget, BlueprintProtected = true, AllowPrivateAccess = true))
UOptionListEntry_Scalar* W_OptionSFXVolumeScalar;

To avoid modifying any core game classes, two delegates are provided that will be triggered upon widget activation and deactivation: OnOptionsWidgetActivated and OnOptionsWidgetDeactivated. You will be using these delegates to trigger your implementation in the next section.

public:
inline static FOnOptionsMenuActivated OnOptionsWidgetActivated;
inline static FOnOptionsMenuDeactivated OnOptionsWidgetDeactivated;

Ready the UI

For the W_Options to work properly, you must complete the following:

Build and open the Byte Wars project in Unreal Editor. Then, go to /Content/TutorialModules/Storage/CloudSaveEssentials/. You will find a data asset called DA_CloudSaveEssentials. Open it and enable the Is Starter Mode Active. Then, save the data asset.

Data asset with starter mode active Unreal Byte Wars cloud save

Resources