- Home /
animation not working
Hi, I'm making a 2d game. I want my player to open a door by pressing a button. I made a button script with a boolean called Open which becomes true when the player triggers the button. Then I wrote a door script saying that when the boolean open is true the anim Door should be played. Here is my script:
var DoorAnim : AnimationClip;
function Update()
{
if(buttonlevel2.Open == true)
{
animation.Play("DoorAnim");
Debug.Log("Open");
}
}
The only problem is that when the boolean open is true the door anim doesn't work and this appears in the console:"the animation state dooranim could not be played because it couldn't be found". I even made a Debug.Log which works. I have also marked my animation as legacy. I hope you have understood and can help. Sorry for my bad english.
Your answer
![](https://koobas.hobune.stream/wayback/20220613194210im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
How to set an Animator Boolean with JavaScript 1 Answer
Animations Not Working 2 Answers
how character's legs(tps) move? 0 Answers
How would you make a shapeshifting mechanic in a game? 1 Answer
How to fix Animation 1 Answer