Game Variables

Game Variables is a flexible tool for managing game data using the Gameplay Tags system. The module supports various variable types and allows customizing their lifecycles (session-based or level-based). Game Variables provides automatic value saving between game sessions and supports network replication. It also integrates with UMG Viewmodel plugin, enabling easy binding of game data to UI elements. This enables easy creation of dynamic game systems, from user settings to complex game mechanics with responsive user interfaces.

Setup

Add Gameplay Tags to identify save files. Each save file requires 1 Gameplay Tag. Use the IndieGameKit.DataSave.* space.

Gameplay Tags

Add Gameplay Tags to identify variables. Each variable requires 1 Gameplay Tag. Use the IndieGameKit.GameVariables.* space.

Gameplay Tags

Create a new Data Asset to configure your game variables.

Data Asset

Pick GameVariablesDataAsset as class for Data Asset instance.

Pick GameVariablesDataAsset as class for Data Asset Instance

Configure your game variables.

Data Asset Content

You can use a single variable template, for many instances, so that you don't have to fill out the same templates for each tag and don't have the hassle of changing the same type of variables, during development.

Variable Template

Go to Project Settings > Plugins > IGK Game Variables and specify the previously created Data Asset

Game Variables Settings

Usage

Game Variables Subsystem

Get GameVariablesSubsystem
GameVariablesSubsystem API

Interacting with variables from within the blueprint of any actor

Select the custom node
Get Game Variable by Tag
Select the custom node
Set Game Variable by Tag

This custom node determines the type of the output and input pin at compile time.

Access to information entered during the setup phase

Get Game Variable Info by Gameplay Tag

UMG Viewmodel

Inside the Widget Designer, you need to select a ViewModel based on the type of data you want to output.

Add ViewModel to Widget

Select the added ViewModel and click the Details tab. In it, give a clear name and select Resolver for Creation Type. Next, select the tag indicating the Game Variable to be tracked. See the screenshot below.

ViewModel Details

In the usual way, use the View Bindings tab to associate a value with UI elements.

View Bindings

A classic approach can be used to track changes to the ViewModel in Blueprint.

Bind
Unbind

Last updated