Object Variables

When you click on the Variable Definitions button it will open up the Object Variables window, which you can then use to generate any number of variables before the Create Event is run for every new instance of the object: 

Object Editor Variables WindowIn this window you can click on the button Add to add a new variable to the list. You can then name the variable as well as set its type and adjust its properties:

Object Editor New VariableThe variable name must start with a letter and can contain only letters, numbers, and the underscore symbol '_' with a maximum length of 64 symbols. So, valid variables are things like fish, foo_bar, num1, and invalid variables would be 6fish, foo bar, or *num. Once you have given the name of the variable you need to set its type, which can be any of the following:Object Editor Variable TypesIt is worth noting that this feature is particularly useful when working with parent/child instances - since you can have a parent object with a set of defined variables and then simply modify them in child object (see the section Object Variables And Child Objects below for more details) - and for when you add instances into The Room Editor (see the section on Layers > Instance Layer), since you can also modify these variables for individual instances that have been placed in the room.

The different types of variable that you can create are listed below:

 

 

Object Variables And Child Objects

An important feature of the Object Variables is that they are inherited by any child objects that you have in the Asset Browser (see the section on Parent Objects for more information), which means that you can then choose to override or change any or all of them if you wish.

When you create a child object of another object resource that has Variables defined for it, these will show up in the Object Variables window like this:

Object Editor Variable In A Child ObjectYou can see in the top image that the Parent object has four Object Variables and in the bottom image these are also shown, only "greyed out" and have the Inherited From Parent Inherited From Parent Icon icon to indicate that they have been inherited. These inherited variables can then be edited if you click the Override Variable Override Variable Icon button, so you can then adjust the range slider or values, or select different items from lists, etc... Note that when you edit a parent variable you can only change the defined value but not the name, nor can you change the variable options. Also note that you can add in new Object Variables to child objects as well (and in the example image above you can see that "Character Type" is a new Object Variable only for the child object).

If you have edited an inherited Object Variable, then you can click the Delete Delete Variable Icon button to remove the edit, but not the variable. The variable will still be inherited from the parent, but will use the parent default value again. If you need to completely remove the variable, then you must do this from the parent object.