error: Assets\CharacterControllerController.cs(15,22): error CS1519: Invalid token ‘;’ in class, record, struct, or interface member declaration
Code:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CharacterControllerController : MonoBehaviour
{
new public Transform camera;
private float cameraRotation;
private float gravity;
public float mouseSensitivity;
public float movementSpeed;
public float gravityScale;
public jumpHeight;
public CharacterController controller;
// Start is called before the first frame update
void Start()
{
Cursor.lockState = CursorLockMode.Locked;
Cursor.visible = false;
}
// Update is called once per frame
void Update()
{
float mouseX = Input.GetAxis(“Mouse X”) * mouseSensitivity;
float mouseY = Input.GetAxis(“Mouse Y”) * mouseSensitivity;
cameraRotation -= mouseY;
cameraRotation = Mathf.Clamp(cameraRotation, -90, 90);
camera.localRotation = Quaternion.Euler(cameraRotation, 0, 0);
gravity -= Time.deltaTime * gravityScale;
if(controller.isGrounded)
{
gravity = -5f;
if(Input.GetKeyDown(KeyCode.Space))
{
gravity = jumpHeight;
}
}
transform.Rotate(Vector3.up * mouseX);
float movementX = Input.GetAxis(“Horizontal”);
float movementZ = Input.GetAxis(“Vertical”);
Vector3 movement = transform.right * movementX + transform.forward * movementZ;
movement = movement.normalized * Time.deltaTime * movementSpeed;
controller.Move(movement);
controller.Move(Vector3.up * gravity * Time.deltaTime);
}
}