- 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 09:53 PM
FIXED. Foolishly my peer who coded the script and created the animation named the animation "MainMenutoBonusContent " note the space!!! he did not! everything works fine we renamed the animation without the unintentional space and viola.
What a wally
Your answer