Skip to content

Utils

Introduction

A Blueprint Function Library class used to load, save and apply all settings

Dependencies

The SettingsUtils relies on other components of this plugin to work:

  • Logger: Used to log useful information to help you debug any issues you might experience
  • Game Instance: Used to monitor for input device changes and handle saving/loading game data

Requirements

It's important that you configure the settings in the Game Instance before you can use the settings feature

Controls Settings

Before you can use the plugin to automatically handle the controls settings, you need to configure your Input Mapping Context. You are required to specify the Name for each key that can be changed through the plugin. This Name should match the value you specify in your Menu Item

NB: This feature is only available on Unreal Engine 5 and newer (UE5.3 support coming soon)

API Reference

Functions

Name Description Params Return
Initialize Initialize the settings GameInstance (UUSKGameInstance*)
A reference to the game instance
LoadSettings Load the settings USettingsData*
The loaded settings data
SaveSettings Save the settings Settings (USettingsData*)
The updated settings data
ApplySettingsInWorld Apply the settings World (UObject*)
The world context

Settings (USettingsData*)
The settings data to apply
ApplySettings Apply the settings GameInstance (UUSKGameInstance*)
A reference to the game instance

Settings (USettingsData*)
The settings data to apply
ConfigureMenuItem Configure the menu item to manage the specified settings item MenuItem (UMenuItem*)
The menu item to configure
SaveMenuItemSettings Save the settings managed by the menu item MenuItem (UMenuItem*)
The menu item containing the updated settings

ApplySettings (bool)
Should the settings also be applied?
ApplyMenuItemSettings Apply the settings managed by the menu item MenuItem (UMenuItem*)
The menu item containing the updated settings
GetSettingsItemForMenuItem Get the settings item for the specified menu item MenuItem (UMenuItem*)
The menu item to get the settings item for

Config (USettingsConfig*)
The settings config specified in the game instance
USettingsItem*
The settings item
GetSettingsItem Get the settings item for the specified settings item type SettingsItemType (ESettingsItemType)
The menu item to get the settings item for

Config (USettingsConfig*)
The settings config specified in the game instance
USettingsItem*
The settings item

Blueprint Usage

You can use the SettingsUtils using Blueprints by adding one of the following nodes:

  • Ultimate Starter Kit > Settings > Initialize
  • Ultimate Starter Kit > Settings > Load Settings
  • Ultimate Starter Kit > Settings > Save Settings
  • Ultimate Starter Kit > Settings > Apply Settings In World
  • Ultimate Starter Kit > Settings > Apply Settings
  • Ultimate Starter Kit > Settings > Configure Menu Item
  • Ultimate Starter Kit > Settings > Save Menu Item Settings
  • Ultimate Starter Kit > Settings > Apply Menu Item Settings
  • Ultimate Starter Kit > Settings > Get Settings Item For Menu Item
  • Ultimate Starter Kit > Settings > Get Settings Item

C++ Usage

Before you can use the plugin, you first need to enable the plugin in your Build.cs file:

PublicDependencyModuleNames.Add("USK");

The SettingsUtils can now be used in any of your C++ files:

#include "USK/Settings/SettingsUtils.h"

void ATestActor::Test()
{
    USettingsUtils::Initialize(GameInstance);
    USettingsData* LoadSettingsValue = USettingsUtils::LoadSettings();
    USettingsUtils::SaveSettings(Settings);
    USettingsUtils::ApplySettingsInWorld(World, Settings);
    USettingsUtils::ApplySettings(GameInstance, Settings);
    USettingsUtils::ConfigureMenuItem(MenuItem);
    USettingsUtils::SaveMenuItemSettings(MenuItem, ApplySettings);
    USettingsUtils::ApplyMenuItemSettings(MenuItem);
    USettingsItem* SettingsItemForMenuItem = USettingsUtils::GetSettingsItemForMenuItem(MenuItem, Config);
    USettingsItem* SettingsItem = USettingsUtils::GetSettingsItem(SettingsItemType, Config);
}