Hi all! I currently have a script that will be used for many different characters in the game, but they all use different animations, which is the only thing that would necessitate the need for different scripts. Is there any way to set up public Animation variables which I can assign the necessary animations in the editor for each character?
Something like
var sleepAnimation : Animation;
I’ve tried this and AnimationState as well to no avail.
Is there any way to do this?
Thank you for your time.
For a start i would have all animations use the same name this way you can create a manager to handle this. I would have an array of animations if there where more than ten or so, So that my inspector didn’t look crazy with loads of variables.
After that i would then know that Idle, is = [0] in the array, walk = [1] in the array and so on.
So i would have this
AnimationClip[] animations
Then to call one of those animations i would say something like
if(player.speed <= 0.1)
{
animation.CrossFade(animations[0].name);
}
This way i can create a one size fits all script. (For somethign with the same animations ;))