So I have a bunch of properties in a C# script, of the following form:
[SerializeField] _property;
public property
{
get { return _property; }
set
{
_property = value;
DoUpdate();
}
}
The DoUpdate function does a bunch of behind-the-scenes stuff that needs to happen whenever the property is changed.
I want to animate these properties using the animation system, but I’m not sure if this is possible? I’ve only been able to animate the serialized field directly, and the C# property does not appear in the Animation window under the ‘Add Property’ dropdown menu, only the serialized variable.
Doing it that way means that the DoUpdate() function never gets called however. As a result, I would have to manually check if the field has been changed every update. Which I would rather not do, as I’m going to have a lot of these properties on many objects.
Is there a way to have the Animator use my C# properties, instead of directly addressing the serialized variables?