Hi!
I’m vwey new to scripting and now I’m working on my own character controller script. Everything seemed to be working fine, but when I tried to play my game Unity said; “All compiler errors have to be fixed”, Error CS1525: Unexpected symbol ‘verticalRotation’. Here’s the script so far;
using UnityEngine;
using System.Collections;
public class FirstPersonController : MonoBehaviour {
public float movementspeed = 5.0f;
public float mouseSensitivity = 5.0f;
float verticalRotation = 0;
public float upDownRange = 60.0f;
// Use this for initialization
void Start () {
Screen.lockCursor = true;
}
// Update is called once per frame
void Update () {
//Rotation with mouse
float rotLeftRight = Input.GetAxis(“Mouse X”) * mouseSensitivity;
transform.Rotate(0, rotLeftRight, 0);
verticalRotation = Input.GetAxis(“Mouse Y”) * mouseSensitivity
verticalRotation = Mathf.Clamp(verticalRotation, -upDownRange, upDownRange);
Camera.main.transform.localRotation = Quaternion.Euler(verticalRotation, 0, 0);
//Movement with keyboard
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();
cc.SimpleMove( speed );
}
}
What’s wrong?
-Dipol