- Home /
JavaScript Error
I have a JavaScript that whenever i press a button, in this case "j", it will play an animation (walk). But whenever i use the script on a FPS Controller in standard assets, it says all compile errors must be fixed before entering playmode.
function Update()
{
if(Input.GetKeyDown("w"))
{
// Plays the walk animation - stops all other animations
animation.Play("walk", Playmode.StopAll);
}
}
Does anyone know how to fix it?
I'm sorry about the typo "in this case "j" " it should actually be " in this case "w" ".
Could you please tell us what the error is? On what line is it? etc...
Your answer
![](https://koobas.hobune.stream/wayback/20220612084804im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Animation Error "unexspected token "if" 1 Answer
How to get the first person controller to collide with an animated object? 1 Answer
Animate mode does not contain definition for GetCurveBindings 2 Answers
Animation State could not be played 2 Answers
Can I export from Adobe Animate CC frames as individual images to be used in Unity? 2 Answers