- Home /
ANSWERED Unexpected symbol 'void' - I am new to coding please help me find the error
Here is the code, ik it is very basic:
using UnityEngine; using System.Collections;
public class FirstPersonController : MonoBehaviour {
public float movementSpeed = 5.0f;
public float mouseSensitivity = 5.0f;
public float upDownRange = 60.0f
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
// Rotation
float rotLeftRight = Input.GetAxis("Mouse X") * mouseSensitivity;
transform.Rotate(0, rotLeftRight, 0);
float rotUpDown = Input.GetAxis("Mouse Y") * mouseSensitivity;
float currentUpDown = Camera.main.transform.rotation.eulerAngles.x;
float desiredUpDown = currentUpDown - rotUpDown;
Camera.main.transform.rotation = Quaternion.Euler(desiredUpDown, 0, 0);
// movement
float forwardSpeed = Input.GetAxis("Vertical") * movementSpeed;
float sideSpeed = Input.GetAxis("Horizontal") * movementSpeed;
Vector3 speed = new Vector3( sideSpeed, 0, forwardSpeed );
speed = transform.rotation * speed;
CharacterController cc = GetComponent<CharacterController>();
cc.SimpleMove( speed );
}
}
Honestly, I would close Unity and your compiler. I used to get a lot of errors like this, but a hard restart normally fixes it.
If it doesn't, what's the line number of the error?
Answer by roojerry · Aug 28, 2013 at 02:11 PM
public float upDownRange = 60.0f
This line needs a semi colon after it
public float upDownRange = 60.0f;
When debugging errors like this, it is common that the error may actually occur on the statement before the line that is showing the error. The compiler won't know that you didn't mean to not close off that declaration, but it will get confused thinking that the next line of code is part of that statement, and throw an error
No problem. Don't forget to mark the question as answered. Good luck developing!
Your answer
Follow this Question
Related Questions
Unity Crashes on startup 2 Answers
semicolon expected while semicolon is present 1 Answer
GetThreadContext failed (Unity 5) 0 Answers
Weird Error c# 1 Answer