dag10 / HoloViveObserver

Shared Reality: Observe a VR session from the same room using a HoloLens!
http://drewgottlieb.net/2017/01/31/mixing-reality-with-vr.html
MIT License
133 stars 31 forks source link

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

Closed cadwallader closed 7 years ago

cadwallader commented 7 years ago

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

dag10 commented 7 years ago

What version of Windows are you running?

nadiacw commented 7 years ago

Hi! I get the same errors without switching the platform to Windows Store, it seems like these variables don't exist in the Holotoolkit script Cursor.cs. Maybe we need a modified version? There's also a missing script reference on the VR Camera Rig. I'm using Windows 10.

I've managed to compile the Hololens app and establish tracking but the app never finds the controllers and as soon as I play in the editor the Steam VR Play Area script disables.

huynj316 commented 7 years ago

I also get the same errors, from the addition of the:

if !UNITY_WSA_10_0

endif

to the SteamVR_Menu.cs script, not sure how to fix. I'm also on Windows 10. The VR Camera Rig in the Main scene is also missing a script ref: missingscript

cadwallader commented 7 years ago

Found workaround (I think). I'm using Windows 10. I removed the offending code prior to building for HoloLens since !UNITY_WSA_10_0 would evaluate to false anyway if I'm understanding its function correctly.

jimmybond commented 7 years ago

@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

pihulj commented 7 years ago

The VR Camera Rig in the Main scene is missing a script ref Does this have a difference on the effect of the demo

dag10 commented 7 years ago

I don't believe it should. I believe others have noticed the missing ref and still got it to work.

And for the record everyone, I can't currently work on this project because I started an internship just after publishing it. I'll likely continue work on it in the fall.

cadwallader commented 7 years ago

Thanks @jimmybond will try. Might this explain why I was able to get through the rest of the set up, hear the commands to align the controller to the hologram, but see no vive controller hologram? (Pulling the controller trigger just anywhere didn't do anything either)

understood @dag10 thanks for sharing your work

cadwallader commented 7 years ago

Works! See solution above by @jimmybond