- Home /
When in play mode, i press W and it exits play mode?
I found a script from a tutorial on YouTube, and it was to make a walking animation play when I pressed W. I went into play mode, and the animation was already playing and when I press W, it exits game mode. Why does this happen? How can I fix it? Here is the script:
function Update()
{
if(Input.GetKeyDown("w"))
{
// Plays the walk animation animation - stops all other animations
animation.Play("walk animation", PlayMode.StopAll);
}
}
Answer by Jeff-Kesselman · May 06, 2014 at 04:10 PM
Chances are that you have an error and that you have pause on error set in your console like this:
Click Error Pause to turn that off.
HOWEVER it wouldn't be an issue if you didn't have an error, so find the error as your first step.
Given that you blindly copied this script, my first guess would be that your animation is not named "walk animation", but thats just a guess.
Your answer
Follow this Question
Related Questions
What's the C# equivalent of @script ExecuteInEditMode() ? 2 Answers
How to identify an asset? 2 Answers
OnSceneGUI called without any object selected 4 Answers
C# Editor script in Unity 1 Answer