Hey, so I’m very, VERY new to Unity (only 5 days in) and I’m trying out my first test project, mainly trying to get stuff written down for when I code in the future. However, I am having an issue. There is one error in my script, and it simply says “Error CS1002: ; expected” However, when I put the symbol there asking for, a ton of errors pop up. And, as I’ve said, I’m new to Unity Codding, so if someone could help, that would be appreciated!
Heres the script:
using UnityEngine;
public class CursorLockExample : MonoBehaviour
{
void Update()
{
//Press the space bar to apply no locking to the Cursor
if (Input.GetKey(KeyCode.Space))
Cursor.lockState = CursorLockMode.None;
}
void OnGUI()
{
//Press this button to lock the Cursor
if (GUI.Button(new Rect(0, 0, 100, 50), “Lock Cursor”))
{
Cursor.lockState = CursorLockMode.Locked;
}
//Press this button to confine the Cursor within the screen
if (GUI.Button(new Rect(125, 0, 100, 50), “Confine Cursor”))
{
Cursor.lockState = CursorLockMode.Confined;
}
}
}