- Home /
Playing animations in a playlist-order automatically?
Hi,
ive baked several camera-animations in maya. After that ive imported the .mb file in unity and selected this file. In the inspector ive added the start- and end-frames for all these different animations and applied these changes.
Then ive attached a camera-object as a child of the gameobject. When i start the game, the default animation is played. Now my question: How is it possible that all my 10 different animations are playing bit by bit automatically (in a playlist-order where i can change the order before i start the game)?
Thanks for your help..
Answer by Paulius-Liekis · May 04, 2010 at 12:12 PM
I don't think there is something like that by default. You will have to write some script that does it for you.
Answer by equalsequals · Jun 01, 2010 at 05:12 PM
One thing I do on import, considering your animations are set up this way, is to actually make a separate animation clip in Unity called "AllAnims" or something similar and make it encompass the entire timeline (ie frame 1-450) and make that the default animation to play on Awake.
Hope that helps.
==
Answer by Ashkan_gc · Jun 15, 2010 at 05:33 PM
you should have a string array and store the names of those animations in the order that you want in the array inside the inspector. define it like this
var anims : string[];
i am not sure that string should be written as String in js or not. i am not a js scripter. to play animations one by one and after each other you should use Animation.CrossFadeQueued as a code example you can write
for (var s in anims)
{
animation.CrossFadeQueued(s);
}
i ignored all optional arguments as you see. let's have an example in C#
foreach (string s in anims)
{
animation.CrossFadeQueued (s);
}
you can stop animations in same layer or wait for all of them with different queuemodes that described well in manual.
Your answer
Follow this Question
Related Questions
Can I make animations snap to a frame? 1 Answer
Camera animations in maya? 2 Answers
How to animate camera effects (legacy)? 0 Answers
Animation without rigging? 2 Answers
How to rig model enough to animate in unity? Just need skeleton? 4 Answers