Description
The Get Attribute behavior will retrieve an attribute from a selected object. You can then output this to use with other behaviors. Attributes can be set from the Object Properties, or set dynamically using the Set Attribute behavior. To learn more about attributes, view the Object Attributes help documentation.
This behavior will Trigger an event immediately when executed. As soon as the behavior is executed it will return the specified attribute.
Properties
Triggers Immediately
Object A |
The attributes that you are seeing are specific to this object. By default the current object is selected, but you can tap the graphic and choose any other object in your scene. |
Predefined |
The Predefined selection will allow you to choose an attribute key that you have previously entered from the Object Properties. |
Dynamic |
The dynamic selection will allow you to manually enter a Attribute Key. Use this if you have dynamically created an attribute using the Set Attribute behavior. Note: Dynamic attributes are attributes that do not exist until your project is running, and another behavior has created it. Until it exists, the key will not return the value. So make sure you are executing this behavior after the set attribute has already created an attribute with the specified name. |
Attribute Key |
This is the name/title of the attribute you want to retrieve. The specified attribute will then return the value stored. For Predefined Attributes, you can tap the button and select the attributes from the list, for Dynamic you must enter the name of the attribute manually. |
Default Value |
Getting an attribute that does not exist will yield the default value. |
Outputs
Attribute Value |
This is the value that is retrieved from the specified attribute. |
Object ID |
This outputs the Object ID. |
Examples
If you have created a "Health" attribute for each of your enemies in your scene, you can use the "Get Attribute" to return the health, and see the amount of health they have stored.
Related
0 Comments