Cursor.visible - is this a bug??

I’m currently trying to use:

    void Start()
    {
        Cursor.visible = false;
    }

The console is printing this error:

Assets\Scripts\Cursor.cs(9,16): error CS0117: ‘Cursor’ does not contain a definition for ‘visible’

Just upgraded to 2020. Could this be a new bug?

It’s because you named your class “Cursor”. So any reference to “Cursor” is using your Cursor class, not Unity’s.

To get around this:

  • Use UnityEngine.Cursor.visible
  • Rename your class
1 Like

FACE.
PALM.
THX.

2 Likes