- Home /
How to animate custom C# properties?
I have a script with several C# properties (not fields) which I want to animate with the legacy function AnimationClip.SetCurve(...). So far I've only been able to animate fields (data members) in my own scripts. I see it's possible to animate several built-in C# properties such as Transform.localPosition. Can I animate properties that I created myself?
Alternatively, is it possible to animate a field of a field, such as a float field inside a custom Serializable class field?
I need this also, If anyone have any idea, please tell ! The only hacky solution I can find is creating another public variable and onUpdate check for the changes, then apply :(
I assume you've already tried both of the things you're asking about. (If you're unsure if something will work, you can always try doing it and see what happens).
If that doesn't work, you could just use a property based on a field rather than an auto-implemented property.
int auto_property { get; set; }
int _manual_property;
int manual_property {
get { return _manual_property; }
set { _manual_property = value; }
}
Your answer
Follow this Question
Related Questions
Retargeting animations in legacy 2 Answers
Using Legacy Assets with Mecanim/Animator? 0 Answers
The AnimationClip 'Attack' used by the Animation component 'Knife' must be marked as Legacy. 1 Answer
How can i change the color of my Mesh Renderer, after Color Animation. 0 Answers
Using root motion scripting for specific animations 1 Answer