Unexpected symbol 'float'
Not sure what I've done wrong. I'm actually watching a tutorial and I copied the exact same script, but it thinks that 'float' is an unexpected symbol. -
using System.Collections; using System.Collections.Generic; using UnityEngine;
public class CameraController : MonoBehaviour {
public Transform target;
public Vector3 offset;
public float rotateSpeed;
// Use this for initialization
void Start () {
offset = target.position - transform.position;
}
// Update is called once per frame
void Update () {
//Get the X position of the mouse & rotate the target
float horizontal = Input.GetAxis("Mouse X") * rotateSpeed;
target.Rotate(0, horizontal, 0);
float vertical = Input.GetAxis("Mouse Y") * rotateSpeed;
target.Rotate(vertical, 0, 0)
//Move the camera based on the current rotation of the target & the original offset
float desiredYAngle = target.eulerAngles.y;
float desiredXAngle = target.eulerAngles.x;
Quaternion rotation = Quaternion.Euler(desiredXAngle, desiredYAngle, 0);
transform.position = target.position - (rotation * offset);
//transform.position = target.position - offset;
transform.LookAt(target);
}
}
Answer by Bunny83 · Oct 28, 2017 at 04:20 AM
You're missing a semicolon at the end of line 20.
In general when you get a syntax error and want help from us you should give us the same information that the compiler is telling you. That includes the line number, the exact error message and the error code (if available). All that can be copied straight from the console message.
Also if you have a syntax error you should first check the line where the compiler complains and if you don't see any thing suspicious the lines directly above the line that causes the error.
Next time you ask debugging problems or syntax error questions, ask them in the help room. I moved your question this time.
You also might want to read the navigation guide that is available on the right side. This included how to properly format code in your questions / answers.