Cursor does not contain definition for visible?

guys help me …
unity says " CURSOR DOES NOT CONTAIN DEFINITION FOR VISIBLE"
is it a compiler error ??

Hi Hrithik,

UnityEngine provides its own class called Cursor, which gives you access to things like Cursor.visible. However, I can see in your inspector you’ve got your own script/class called Cursor - this will always take priority over the underlying UnityEngine Cursor class, so when you try to use Cursor.visible it looks in your class, not Unity’s! If you rename your own Cursor class (and the .cs file) to something else, you should find this works again :slight_smile:

You should always be a bit careful of things like this when naming new classes. This is why in the course, Ben uses a class name like CursorAffordance - it’s a bit more unique and much less likely to be hiding any underlying Unity source code.

THANK YOU jonnyf3.

you saved my day … once again thanks a lot…:star_struck::star_struck:

No worries, happy to help! :smiley:

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms