# Variables

**Game Creator** comes with a variables system that allows you to keep track of the game progress and save the state between play sessions.

![](https://2174264233-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LAqwYovmUPn5V6CMeID%2F-LB2CD31iTnsA1qOmZ2L%2F-LB2DLXXXv_rHe-oOAs-%2Fvariables-example.jpg?alt=media\&token=c4a585eb-ce7c-4369-b61d-36e809321026)

A **variable** is a value container with information that can be changed during gameplay.

{% hint style="info" %}
For example, in a **Zelda** game, the hearts at the top of the screen would be a variable identified by the name "*hearts*".
{% endhint %}

![(You can track the Player health creating an integer variable called "hearts")](https://2174264233-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LAqwYovmUPn5V6CMeID%2F-LB2CD31iTnsA1qOmZ2L%2F-LB2DOoVfedrB_SanteT%2Fvariables-header.jpg?alt=media\&token=b0287836-6089-4a32-b546-f420cca62bfb)

There are different types of Variables:

* [Global Variables](https://docs.gamecreator.one/game-creator/game-creator/variables/global-variables): Identified by a unique name.
* [Local Variables](https://docs.gamecreator.one/game-creator/game-creator/variables/local-variables): identified by a unique name. Only affect one scene.
* [List Variables](https://docs.gamecreator.one/game-creator/game-creator/variables/list-variables): An array of values accessed by index. Only affect one scene.

{% hint style="info" %}
Variables can also be accessed through code. Head to [Variables Access](https://docs.gamecreator.one/game-creator/systems/game-creator-api/variables-access) to know more.
{% endhint %}

## Anatomy of a Variable

A **variable** is has a `name` that identifies it (for example: “shotgun ammo“) and a `value`.&#x20;

A variable can have different types of values, including character **strings**, **numbers**, **booleans** (on/off), **Colors**, **Vector3**, and references to **Game** **Objects**.

{% hint style="info" %}
Next to the name there's a checkbox. This allows to save the variable's state between play sessions
{% endhint %}

{% hint style="warning" %}
Not all variable types allow to save its state. For example, **Game Objects** can't be saved because they are a reference type, which Unity doesn't allow to serialize.
{% endhint %}
