I Need Help With A Script

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;
}
}
}

which ide do you usde? Please provide a screenshot before and after the “bunch of errors”

i’ll be glad to help you out if i could understand what are the errors show after you’ve written down the semi colon

Sometimes when you fix one error the compiler will report more errors than before. That doesn’t always mean that you have more errors than before, though. When you fix one error then the compiler will be able to interpret your code more clearly and that will allow it to identify errors that were always there, but it couldn’t find before.

That exact script works for me. Please post the exact error, and a screenshot. Where did you get this code?