I have multiple gameobjects throughout the scene that have two animations. I need to play either the first or second animation without changing their imported animation names.
Is there a way I can include in the function for it to call the animation using its element? Like element 0, element 1, as found in the inspector.
Bare with me, I do modeling/texturing/animation. Some scripting makes sense then I run into something I can’t figure out like this. Thanks for any help!
Currently I have:
#pragma strict
function OnMouseOver()
{
if(Input.GetMouseButtonDown(0))
{
animation.Play("r_gear_down");
}
}
This works just fine, however I would have to write over 500 individual scripts for each separate game object. I’d like to write one script and add it to each one instead. I monkeyed around with trying to identify animation clips with no success.
Thanks!
(I used the format code button, but it appears it didn’t want to give the lines. Sorry!)