Question by
Ugoslight23 · May 05, 2017 at 06:54 PM ·
error message
Hello. I'm getting this error message. (58,246) CS1525: Unexpected Symbol 'end-of-file'
Here's a copy of my code... I can't seem to figure what the problem is using System.Collections; using System.Collections.Generic; using UnityEngine;
public class KeyBoardMoves : MonoBehaviour { public float speed = 5.0f; public float rotateSpeed = 20.0f; public bool canNotMoveSideways = true;
void Update ()
{
Movement ();
}
void Movement()
{
if (Input.GetKey (KeyCode.UpArrow)) {
Debug.Log ("Up arrow is being pressed!");
this.transform.Translate (new Vector3 (0, speed * Time.deltaTime, 0));
}
else if (Input.GetKey (KeyCode.DownArrow)) {
Debug.Log ("Down arrow is being pressed!");
this.transform.Translate (new Vector3 (0, -speed * Time.deltaTime, 0));
}
if (Input.GetKey (KeyCode.LeftArrow)) {
if (canNotMoveSideways)
{
Debug.Log ("You are now rotating left.");
this.transform.Translate(new Vector3 (0, -rotateSpeed*Time.deltaTime, 0));
}
else
{
Debug.Log ("Left arrow is being pressed!");
this.transform.Translate (new Vector3 (-speed * Time.deltaTime, 0, 0));
}
}
else if (Input.GetKey (KeyCode.RightArrow))
{
if (canNotMoveSideways)
{
Debug.Log("You are now rotating right.");
this.transform.Translate (new Vector3 (0, rotateSpeed*Time.deltaTime, 0));
}
else
{
Debug.Log ("Right arrow is being pressed!");
this.transform.Translate (new Vector3 (speed * Time.deltaTime, 0, 0));
}
}
}
Comment
Best Answer
Answer by kre-sod · May 05, 2017 at 06:59 PM
maybe you need to add 1 more '}' in the end?
Answer by Ugoslight23 · May 05, 2017 at 07:12 PM
Oh Oh Oh. I figured it out!! I was missing a curly brace smh..rookie error