I’m trying to build a list of animations on a gameobject so I can present it as a dropdown in a tool. The code works, but if I add animations, the list of animations I get back from the Animation component doesn’t update until after I play or restart the editor.
Here’s how I’m collecting the animations:
List<AnimationState> animations = new List<AnimationState>();
if (gameObject != null)
if (gameObject.animation != null)
foreach (AnimationState anim in gameObject.animation)
if (anim.clip != null)
animations.Add(anim);
Again, it works, but the list doesn’t update as I add animations.
Am I doing something wrong? Is there a way to force an update? Is this a bug?