[SOLVED] Assets/SteamVR/Scripts/SteamVR_Menu.cs(245,16): error CS0117: `Cursor' does not contain a definition for `visible'
See original GitHub issueUpon opening the project folder in Unity, Unity displays the following compile errors (and 4 additional instances of the same errors):
Assets/SteamVR/Scripts/SteamVR_Menu.cs(245,16): error CS0117: 'Cursor' does not contain a definition for 'visible'
Assets/SteamVR/Scripts/SteamVR_Menu.cs(246,10): error CS0117: 'Cursor' does not contain a definition for 'lockState'
these errors map to the following code blocks:
#if !UNITY_WSA_10_0
Cursor.visible = savedCursorVisible;
Cursor.lockState = savedCursorLockState;
#endif
#if !UNITY_WSA_10_0
savedCursorVisible = Cursor.visible;
savedCursorLockState = Cursor.lockState;
#endif
#if !UNITY_WSA_10_0
Cursor.visible = true;
Cursor.lockState = CursorLockMode.None;
#endif
Issue Analytics
- State:
- Created 7 years ago
- Comments:9 (2 by maintainers)
Top Results From Across the Web
Cursor does not contain definition for visible? - Ask
Hi Hrithik,. UnityEngine provides its own class called Cursor, which gives you access to things like Cursor.visible. However, I can see in ...
Read more >Cursor.lockState and Cursor.visible not working on 2018.3. ...
Assets\Cursorhide.cs(10,20): error CS0117: 'Cursorhide' does not contain a definition for 'visible' this is what comes up for me.
Read more >error CS0117 in Unity
Cursor class resides in UnityEngine instead of Screen class. So it is unable to find Cursor.lockState . Have a look at this example...
Read more >Why am I getting this error? : r/Unity3D
Assets\Scripts\Player\playerCamera.cs(17,16): error CS0117: 'Cursor' does not contain a definition for 'lockstate') The Code: using…
Read more >Cursor does not contain a definition for "SetCursor' or why ...
Solution : name your class something that does not collide with other types you want to use, like public class CustomCursor : MonoBehaviour...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@andrew-cadwallader There are two classes named Cursor.
Basically, you need to specify to the compiler to use UnityEngine Cursor script. You can do this by replacing Cursor with UnityEngine.Cursor, for example:
#if !UNITY_WSA_10_0 UnityEngine.Cursor.visible = savedCursorVisible; UnityEngine.Cursor.lockState = savedCursorLockState; #endif
Hope this helps
Works! See solution above by @jimmybond