Resolve AnimationClip curve binding at runtime.
When i parse AnimationClip.curves in the editor script i get something like:
path=Gameobject1/Gameobject2
type=MyCustomComponent
propertyName=m_MyFloat
I can resolve this back on Awake() using System.Reflection etc. BUT!
UnityEngine.Transform
Color
..and some other unity classes are serialized as separate curves like:
path=Gameobject1/Gameobject2
type=UnityEngine.Transform
propertyName=localPosition.x
..or..
path=Gameobject1/Gameobject2
type=MyCustomComponent
propertyName=color.r
This drives me mad..
I need to build property references hash-table at runtime like: Dictionary<string, float> Bindings
, where string key
is a concatenation of path, type(component name) and property name and float value
is reference to an actual field
Only thing i've found is to call Animator.Rebind();
but i don't get how to hack down to the actual references. Maybe there is a way to force Unity to serialize its' stuff in a standarts-compliant way so it won't be 4 bindings for Color type, but one Vector4? (same for Transform etc)