Cursor.SetCursor

For some reason I keep getting this error with my code in my console view:

‘Cursor’ does not contain a definition for ‘SetCursor’

Thoughts on why C# is not allowing me to use this segment of code?

[SerializeField] Texture2D walkCursor = null;
[SerializeField] Vector2 cursorHotSpot = new Vector2(96, 96);
   

CameraRaycaster cameraRaycaster;

Wonder why this is not coding out right.
void Start () {
    cameraRaycaster = GetComponent<CameraRaycaster>();
}


void Update () {

    Cursor.SetCursor(walkCursor, cursorHotSpot, CursorMode.Auto);

You can either change the references of Cursor.SetCursor(...) to UnityEngine.Cursor.SetCursor(...) throughout, or you will need to rename any local script added to your project called Cursor.cs to something else in order to avoid the conflict.

Privacy & Terms