I’m trying to learn and understand Unity, started a while ago, and I’ve been following some tutorials.
Still I’m getting the following error: CS1525: Unexpected symbol ‘speed’ in the line (49,21).
using UnityEngine;
using System.Collections;
public class FPScontroller : MonoBehaviour {
public float movementSpeed = 5.0f;
public float mouseSensitivity = 2.0f;
public float jumpSpeed = 20f;
float verticalRotation = 0;
public float upDownRange = 60.0f;
float verticalVelocity = 0;
// Use this for initialization
void Start () {
Screen.lockCursor = true;
}
// Update is called once per frame
void Update () {
CharacterController cc = GetComponent<CharacterController>();
//rotation X
float rotLeftRight = Input.GetAxis("Mouse X") * mouseSensitivity;
transform.Rotate(0, rotLeftRight, 0);
//rotation Y
verticalRotation -= Input.GetAxis("Mouse Y") * mouseSensitivity;
verticalRotation = Mathf.Clamp (verticalRotation, -upDownRange, upDownRange);
Camera.main.transform.localRotation = Quaternion.Euler(verticalRotation, 0, 0);
//Walking
float forwardSpeed = Input.GetAxis("Vertical") * movementSpeed;
float sideSpeed = Input.GetAxis("Horizontal") * movementSpeed;
verticalVelocity += Physics.gravity.y * Time.deltaTime;
Vector3 speed = new Vector3 (sideSpeed, Physics.gravity.y, forwardSpeed)
speed = transform.rotation * speed;
cc.Move(speed * Time.deltaTime);
}
}
Where/what is the problem?