- Home /
OK someone help me please (I couldn't think of a better title)
im Very new to code and i know you guys get pissed with noob questions but whatever i have no idea why i keep getting an error and i think im going to rip my head off if i dont figure it out it has to be one on the simplest codes ever written yet i cant figure it out
using UnityEngine; using System.Collections;
public class punch : MonoBehaviour {
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
{
if (Input.GetKeyDown(KeyCode("q")) {
gameObject.animation.Play("punch");}
}
}
}
Please learn to format code in your question correctly. There's a video link in the right side bar. Also, your question title is a bit, um, poor.
Answer by tomezpl · Jun 17, 2014 at 02:33 PM
There's a bracket you don't need in the 9th line, before the "if" statement.
There is one behind the if statement as well, so it should not break the code. Better though, is to remove both the useless brackets.
I am presu$$anonymous$$g here that the lowest bracket is the class end bracket.
Agreed, there are two squiggly brackets around the if statement that aren't required and I think the main problem is that you are missing a normal bracket in the if statement line, it should be:
if (Input.Get$$anonymous$$eyDown($$anonymous$$eyCode.Q))
taking in consideration pstreef's comment
$$anonymous$$y mistake, there is indeed a normal bracket missing. I mistook the na$$anonymous$$g of normal for the squiggly brackets.
Your answer
Follow this Question
Related Questions
Help with syntax error 1 Answer
Unity syntax error (I think is bug) 0 Answers
Unity Error on Startup ? 0 Answers
Very Basic BCE0019 error 0 Answers