- Home /
Add Curve key to Timeline CustomClip via C# script not working.
I have a CustomClip from a Custom Timeline Playable which controls blendshapes on a model. I can add curve keys manually but cannot add keys via script. So far I can add the clip via C#, set name and duration but the SetCurve function is throwing a NullReferenceException. Any thoughts would be greatly appreciated.
var newCustomClip = track.CreateClip<BlendShapesClip>();
newCustomClip.displayName = "My New Clip";
newCustomClip.duration = 10;
Keyframe[] keys;
keys = new Keyframe[3];
keys[0] = new Keyframe(0.0f, 0.0f);
keys[1] = new Keyframe(1.1f, 1.5f);
keys[2] = new Keyframe(2.0f, 0.0f);
curve = new AnimationCurve(keys);
newCustomClip.curves.SetCurve("", typeof(BlendShapesClip), "Blend Shapes Clip.Shape Weight", curve);
Cheers
Comment
Your answer
