This is an advanced topic that aims to bring access to coherence's internals to the end user.
CustomBindingProviders are editor classes that tell coherence how a specific component should expose its bindings and how it generates baked scripts.
For example, we could create a custom binding provider for our Health component:
Place CustomBindingProviders inside an Editor folder.
We can add additional (custom) bindings:
In order for these new custom bindings to work on reflected mode, we'll need to implement a runtime serializer that understands how to deal with them.
Check the CustomBinding.Descriptor
API for further properties, like interpolation or marking the binding as required.
For custom bindings to work on reflected mode, we need to implement how their values are serialized and deserialized at runtime:
CustomBindingRuntimeSerializers should be placed in a non-Editor folder.
Once we have our runtime serializer, we need to make our binding provider use it:
You can extend an already existing CustomBindingProvider. For example, coherence ships with a CustomBindingProvider for Transforms:
This way, you can define additional rules on how you want to treat your Transforms, for example.
Any amount of CustomBindingProviders can be registered over the same component, but only one being used. The one being used, is resolved by a priority integer that you can specify in the CustomBindingProvider attribute. The class with the higher priority defined in the attribute will be the only provider taken into account:
The default priority is set at 0
, and coherence's internal CustomBindingProviders have a priority of -1
.
To understand how these APIs are used, check out TransformBindingProvider and AnimatorBindingProvider, both shipped with the coherence SDK (<package>/Coherence.Editor/Toolkit/CustomBindingProviders
).