question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[SOLVED] Assets/SteamVR/Scripts/SteamVR_Menu.cs(245,16): error CS0117: `Cursor' does not contain a definition for `visible'

See original GitHub issue

Upon 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:closed
  • Created 7 years ago
  • Comments:9 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
jimmybondcommented, Feb 14, 2017

@andrew-cadwallader There are two classes named Cursor.

  1. located in UnityEngine (provides the visible and lockstate functions)
  2. located in holotoolkit (HoloToolkit-Examples\SpatialUnderstanding\SpatialUnderstanding-FeatureOverview\Scripts).

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

0reactions
cadwalladercommented, Mar 1, 2017

Works! See solution above by @jimmybond

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found