Variables
v4.0
Last updated
v4.0
Last updated
Variables, which can be set on the PrefabAndObjectManager
component, allow individual objects to only be activated if specific conditions are met. Currently bool
, float
, and string
variables can be set, and each object can check for one variable value.
If you have the Dragons character pack, the demo prefab has been updated to use variables to determine whether the saddle and similar objects should show, as well as whether the saddle or non-saddle version of the back options should show.
Click on the "Variables" tab, where you can name and add new variables. The name is how you set and get the variable values via code. You can also set a default value for each value type here.
Each object in each group now has the option of adding a variable. By default, no variable is selected, and variables will have no impact on the object. Once selected, you have the option to select which variable type (bool
, float
, or string
), and the criteria, which is different for each type.
In the example above, the "Carapace" will only activate when the bool
value for "Saddle" is false, while "CarapaceSaddled" will only activate when the value is true.
Click the "Recycle" icon to remove the variable effect.
Check the PrefabAndObjectManager.cs
script to see all the new methods, with the most useful ones shown below.