- Home /
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.
Answer by runevision · Nov 11, 2009 at 12:22 PM
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:
The documentation page about Character Animation.
The Character Animation Example Project from the resources section on our website.
Yes the clip is in the Animations component. I cannot find a single complete script anywhere for triggering an animation and no one seems to be able to give me other than very general information that I already know but doesn't tell me how to put a script together correctly. A few samples of scripts for triggering Unity animations would help me, and the others on the forum with the same problems, figure out what to do. The script reference just gives you isolated bits of information, no examples of a correct complete script that you can study.
I added links in my answer to resources with plenty of example scripts of how to trigger animations, and other things, including complete examples.
Answer by Davies · Dec 01, 2009 at 02:18 PM
Thanks also for the additional links. I shall look into them.
Cheers
Answer by Davies · Nov 28, 2009 at 12:27 AM
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.
Your answer
![](https://koobas.hobune.stream/wayback/20220613160936im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
The name 'Joystick' does not denote a valid type ('not found') 2 Answers
Fireflies... 1 Answer
Animation script with is.grounded help 0 Answers
How do I break apart an object? 2 Answers
Why might an Animation play fine in the Editor but not on an iPad? 0 Answers