- Home /
Question by
blossombomb · May 14, 2016 at 10:52 PM ·
parsing errorunexpected-symbolcs1525cs1519unexpected-token
Unexpected symbols
Could someone tell me what's wrong with my code? Unity's telling me I have a bunch of "unexpected symbols," including: if, (, ), =, and ;
Sorry, really new to this.
{
//Movement
public float speed;
public float jump;
float moveVelocity;
//Grounded Variables
bool grounded = true;
void Update ()
{
//Jumping
if(Input.GetKeyDown (KeyCode.Space) || Input.GetKeyDown (KeyCode.UpArrow) || Input.GetKeyDown (KeyCode.Z) || Input.GetKeyDown (KeyCode.W))
{
if(grounded)
{
GetComponent<Rigidbody2D> ().velocity = new Vector2 (GetComponent<Rigidbody2D> ().velocity.x, jump);
}
}
//Left Right Movement
if (Input.GetKey(KeyCode.LeftArrow) || if(Input.GetKey(KeyCode.A))
{
moveVelocity = -speed;
}
if (Input.GetKey(KeyCode.RightArrow) || if(Input.GetKey(KeyCode.D))
{
moveVelocity = speed;
}
GetComponent<Rigidbody2D> ().velocity = new Vector2 (moveVelocity, GetComponent<Rigidbody2D> ().velocity.y);
}
}
Comment
That's your whole script? Where's your class declaration? Why do you start with a { ?
Your answer
Follow this Question
Related Questions
Unity always gives me errors 1 Answer
PLEASE HELP!!!! using BergZurgArcades guide having error! 5 Answers
Parser Error Unexpected symbol `m_MovementAudio' 1 Answer
Not expecting void Start 2 Answers
Errors in the Code - Please help! 0 Answers