scripting for Animation Editor animations

Has anyone got a sample script for using an animation created by the Animation Editor? I'm very new to scripting, my previous script that works with imported animations doesn't function with Unity ones and I can't figure out what I'm doing wrong from the docs. A sample script of a simple animation triggered by the FPC would help enormously.

Since AnimationClips are the same no matter if they were created inside Unity or not, the problem is likely somewhere else.

Please make sure that the AnimationClip in question is actually in the Animations list of the Animation component on the GameObject you want to animate.

  • If it is there, you should be able to play the animation through scripting just like the other animations that are in the Animations list in the Animation component. See the scripting reference for more info.

  • If it is not there, you need to find out where you saved the AnimationClip and drag the clip from there (in the Project view) into an empty slot in the Animations list in the Animation component of the GameObject you want to animate.

If you want general advise on how to do animation scripting in Unity, these are the must-see resources:

It was a problem within the animation itself. Not the script.

Which was weird for me as it's the scripting I have problems with.

Anyway, rebuilt the animation and it all worked fine.


Thanks also for the additional links. I shall look into them.