Unit Reference Machine Variables - RealityStop/Bolt.Addons.Community GitHub Wiki
Machine Variables are not actually a unique variable type, but a way to reference graph instances, treating the assets as classes, and machines as class instances.
Get Machine
To get a machine of a specific type, use the Get Machine unit. Choose a type from the drop down, and it will return the first instance of that type.
Under the hood, Get Machine calls GetComponents<ScriptMachine>()
. After it returns all ScriptMachines on a target object, it will run a for loop over them for the matching asset then return immediately if one is found, otherwise it returns null.
You can find the unit under Community > Graphs > Get Machine
.
Get & Set
Get and Set variables are nearly identical to the Get and Set Graph Variables, with 2 exceptions.
- They are not unified, instead, they contain a Script Asset reference in the header.
- The dropdown of names is filtered by the asset graph variable declaration.
- There is no Has Unit. A declaration is treated as a class, therefore the definition is constant graph side, until you make a change to the graph itself.
Machine Is
The Machine Is
Unit, allows you to test if a machine references asset matches the given type in the Is unit. Do this to check between multiple types, doing unique behaviour depending on it.