Overview
Property Bindings is a system for binding values in the editor. CAS uses it to link gameplay code (e.g., character controllers) with the animation system (Procedural Animation and Layered Blending).
Example of a property binding.
Binding Values
When pressing the ”+” icon, a property binding will try to search for potential bindable public fields, properties, and methods. Here is what happens on the low level:- Get a GameObject context — it is typically a player prefab reference, provided by the interface.
- Iterate over all components and look for public fields, properties, and methods that return the desired type.
- Create a dropdown menu with potential bindables.
- Once a bindable is selected, the binding’s path and component type will be updated.
Initialization
Property Bindings needs to be manually built, which typically happens when the game starts:ModifyBoneSettings.cs
ModifyBoneJob.cs
Getting a value
BindableProperty.GetValue() is used to return the current value of a bound property.
BindableProperty.SetDefaultValue(T value) is used to update the default value of the property. The default value is only used when:
- A property wasn’t initialized successfully.
- One of the references is null.