- Home /
Playing animation elements not working
We are animating a camera to move from place to place. We have seven animations created in unity animator which are all applied as elements (element 0 - 6) to an animation component on the camera.
animation.wrapMode = WrapMode.Once;
function Awake() { animation.Play("OpeningtoMainMenu"); }
function MainMenutoBonusContent() { Debug.Log ("script gets here"); animation.Play ("MainMenutoBonusContent"); }
This is our code so far (the rest of the code looks the same with different animation names) Our 1st animation plays no problem (function awake) yet we keep getting the error:-
The animation state MainMenutoBonusContent could not be played because it couldn't be found! Please attach an animation clip with the name 'MainMenutoBonusContent' or call this function only for existing animations.
This exact method has worked for us on previous projects so we do not understand what is going wrong at all? The trigger button is sending a message and the debug log is firing fine. What should we do?
Answer by AngryOldMan · Mar 08, 2011 at 10:14 PM
Have you perhaps named your animation with an extra space at the end? I think you have and thats the reason when you name your animation in the script it doesn't work. You know what I mean, you know you did it, I'm watching you buddy.
oh yeah man guess what, this complete plonker did that exact thing. what cheese donkey!
Your answer
Follow this Question
Related Questions
Camera Animation On Click Help? 1 Answer
Animation Play Problem (Att: Video Example) 1 Answer
animation play in game over 1 Answer
Camera Pan 1 Answer