Local Variables are one of the most useful Game Creator tools. They allow to access different variable instances from different game objects but with the same name.
For example, let's say you want to give each character of your game a unique name. You can create a Local Variables component on each one of them and create a local variable called
When accessing it, each character will return its own unique name.
To create a local variable you can add the
Local Variables component to any game object. Alternatively you can create one using the Game Creator Toolbar option to create a new instance.
Notice there's a UID field at the end of the component. This
UID is used by the save-system to keep track of the different variables between play sessions.
Every time you create a
Local Variable, a unique
UID is generated. You have to bear in mind though that when duplicating a
Local Variable, this value will stay the same and two
Local Variables will exists with the same
UID. In that case, click on the
R button to generate a new unique button.
Just like Global Variables, Local Variables have a little checkbox next to its name field. Marking it will tell Game Creator that this variable value must be tracked between play sessions.