x


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.

more ▼

asked Nov 10 '09 at 07:00 PM

Davies gravatar image

Davies
84 6 6 9

(comments are locked)
10|3000 characters needed characters left

3 answers: sort oldest

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:

more ▼

answered Nov 11 '09 at 12:22 PM

runevision gravatar image

runevision ♦♦
8.1k 29 46 112

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.

Nov 15 '09 at 09:03 PM Davies

I added links in my answer to resources with plenty of example scripts of how to trigger animations, and other things, including complete examples.

Nov 16 '09 at 09:11 AM runevision ♦♦
(comments are locked)
10|3000 characters needed characters left

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.

more ▼

answered Nov 28 '09 at 12:27 AM

Davies gravatar image

Davies
84 6 6 9

(comments are locked)
10|3000 characters needed characters left

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

Cheers

more ▼

answered Dec 01 '09 at 02:18 PM

Davies gravatar image

Davies
84 6 6 9

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x5056
x3768
x1664

asked: Nov 10 '09 at 07:00 PM

Seen: 3327 times

Last Updated: Nov 10 '09 at 07:00 PM