Dynamic Properties
Dynamic properties are a feature of the Blackboard that allows you to get/set properties on objects in the blackboard. For example, instead of using nodes to get and set the position of a GameObject
variable, you can use the actual properties of the object when assigning it in the inspector. This drastically reduces the amount of nodes present in your tree, and makes it easier to see past the fluff and look at the important parts of the tree.
Dynamic properties are not recommended if you are compiling using IL2CPP or for an AOT platform like iOS. Dynamic properties use dynamic code generation to get and set values for fields and properties extremely quickly, almost as fast as native access. However, this method is not possible when using AOT due to restrictions on the platform. Dynamic properties will be much slower when compiling for these platforms.
Using dynamic properties is extremely simple. Unless the node has the [DisableDynamicBinding]
attribute set for its selectors, you will see a dropdown of the properties when selecting an entry for a field.
An example of where you might use dynamic properties is moving towards a position. Without Dynamic Properties, if you are trying to move towards a GameObject
, you will have to get the position manually and then move towards that. With Dynamic Properties, you can access transform.position
without any extra steps.