- Home /
Question by
Sunrunner · Nov 02, 2014 at 08:17 AM ·
animationanimation clipanimation editor
Animation AddClip Silent Failure
I am using the below code to add an AnimationClip to an animation:
personGameObject.GetComponent<Animation>().AddClip(clip.Value, clip.Key);
Debug.Log("Added animation clip " + personGameObject.animation.GetClip(clip.Key).name);
The above code snippet throws a null pointer because it could not get the clip I just added. There is no indication why this failed. In addition to that, the following line works:
personGameObject.GetComponent<Animation>().clip = clip.Value;
This will make the clip show up properly in the editor. I want to be able to add multiple clips to an animation but it just silently fails.
Comment
Your answer
Follow this Question
Related Questions
Animation Bugging out 2 Answers
How to advance a legacy animation by n number of seconds/frames? 1 Answer
Animation frame size workaround? 0 Answers
Animation lengths doesn't match 1 Answer
Animation View Properties Disappearing 0 Answers