๐ง Working with Variables
The Saveable
component allows storing key-value string pairs during runtime.
๐ Blueprint Functions
โน๏ธ All Saveable variables are stored as strings internally. Use
GetVariableAsInt
or manual conversion for numeric operations.โ Saveable variables are ideal for counters, flags, or state values that don't need to exist as native Blueprint variables.
Available under Save Kit โ Saveable
:
SetVariable(Name, Value)
โ set a string value at runtimeGetVariable(Name)
โ get string valueGetVariableAsInt(Name)
โ parse as integerHasVariable(Name)
โ check if variable existsIncrementVariable(Name, Amount)
โ add to numeric valueRemoveVariable(Name)
โ delete variable
โ๏ธ Example: Using Saveable Functions
Use Saveable functions to manage data at runtime:
SetVariable
โ assign a valueGetVariableAsInt
โ retrieve and modify numeric valuesIncrementVariable
โ track counts or scores
Example: reducing Health, marking as Damaged, and incrementing HitCount.
๐ Saveable Variables vs SaveGame Properties
Use
Saveable
for lightweight, flexible runtime data.
UseSaveGame
for Blueprint-visible variables and type-safe access.
Method | Defined In | Access at Runtime | Saved by SaveKit |
---|---|---|---|
Saveable Variables |
Saveable Component | โ๏ธ via Blueprint nodes | โ๏ธ Yes |
SaveGame UPROPERTY |
Actor/Blueprint field | โ๏ธ directly (Get/Set) | โ๏ธ Yes (if serializable) |
Use Saveable
for flexible runtime state, and SaveGame
for native Blueprint variables.
Note: Actor transform, tags, and SaveGame properties are also saved.
See Saving & Loading for details.
๐งช Example: Displaying Saved Data
Use GetVariable
, Tags
, and SaveGame
properties to dynamically show state:
This Blueprint formats and displays Health, HitCount, Tags, and Damaged state.
๐ซ Limitations of Saveable Variables
โ ๏ธ Only string values are supported in Saveable variables. Complex types like vectors, rotators, and structs are not supported.
- UObject references
- Arrays of objects
Use IDs or reconstruct them manually after loading.
โน๏ธ See Limitations for serialization compatibility.