PROTO Profiles & Options

Most Savefields save a single value of a given type. For example, a single integer, float, or string.

Array Savefields instead save N values of a given type. This allows you to save a large number of values associated with a single Savefield name, and Set/Get them by index.

Array Savefields are of static size, meaning the max number of entries is predetermined, and every index always exists and is valid. Entries that are not set yet will contain their default value as defined in your DataTables.

Array Savefields have some limitations.


See the bottom of this page for more information.

Why Use Arrays?

There are various circumstances in which Array Savefields are convenient. For example:

  • Your player can hold an arbitrary number of items, and you need to store an array of item IDs.
  • Your game has 10 levels, and you want to store information per-level and access is by level index.

Array Savefields can be of any Type that normal Savefields can be.

Arrays of Custom Save Objects

A specific use-case that Array Savefields are useful for is storing arrays of Custom Save Objects. This allows you to define a collection of data about an aspect of your game, and then store multiple copies of that object.

For example, in a first person shooter you could create a Custom Save Object that defines the saved-state of a player’s weapon (what upgrades the weapon has, how much ammo is in reserve, and how many rounds are in the current magazine). Then, you can define an Array Savefield that stores N weapons to the player’s save file.

Creating Array Savefields

You can turn a regular Savefield into an Array Savefield in your DataTables by checking the box for “Is Array”.

You can then set the max entries via the “Array Max Entries” field that appears.

Using Array Savefields

Most operations on Array Savefields are done with the same functions used for regular Savefields.

In Blueprint, expand the node to view optional parameters, and pass in an Array Index.

In C++, use the ArrayIndex parameter.

There are two additional functions specific to Array Savefields:

  • GetSavefieldArray / GetSavefield[Type]Array - get the entire array of values.
  • GetSavefieldArrayNumEntries - get the number of entries stored by this Array Savefield.

Limitations

No Auto-Populating in Menus

Auto-populating ListViews that display Savefields will not display Array Savefields.

To display Array Savefields in menus, you will need to manually populate your own widgets.

No Un-Committed Values

Array Savefields cannot be Set without being Committed. Any changes will always be committed to the game.