I know this question is old, but I thought I'd share my fix.
I had 80 animated characters all with the same 5 animations, though some of them were named differently because it would be the walk cycle for a crawling baby or an old man with a walking stick, therefore different from the walk cycle of my generic humans.
What I did was create a script that just had a variable for animationClips.
var animList : AnimationClip[];
That's it, that's all my script had lol. Then I applied it to the prefabs of all my 80 chars, and listed their animations in respective order:
bind
walk
flinch
dance
suicide
Then in script I just said
gameObject.animation.Play(getComponent(AnimList).animList[0]);
basically I couldn't access THEIR array so I made my own array that I COULD access.
↧