Search Unity

2 compiler errors with steamVR for unity

Discussion in 'AR/VR (XR) Discussion' started by Hormic, Mar 22, 2016.

  1. Hormic

    Hormic

    Joined:
    Aug 12, 2014
    Posts:
    251
    I tried to play around with SteamVR, even if i have no dev version yet and waiting eagerly the arrival of the Vive consumer version.

    But i got 2 compiler errors with unity 5.4.0b10 right at the beginning:

    Assets/SteamVR/Scripts/SteamVR_UpdatePoses.cs(17,36): error CS0103: The name `TargetEyeMask' does not exist in the current context

    Assets/SteamVR/Scripts/SteamVR_UpdatePoses.cs(17,24): error CS1061: Type `UnityEngine.Camera' does not contain a definition for `targetEye' and no extension method `targetEye' of type `UnityEngine.Camera' could be found (are you missing a using directive or an assembly reference?)

    Is it because i have no HMD attached, or has it other reasons?


    Edit:
    OK found allready the solution:

    You can fix the error like this :
    #if !(UNITY_5_4_OR_NEWER || UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0)
    camera.targetEye = TargetEyeMask.kTargetEyeMaskNone;
    #endif
     
    Last edited: Mar 22, 2016
    Don-Gray likes this.
  2. sondyr

    sondyr

    Joined:
    Apr 13, 2014
    Posts:
    7
    Thank you, this worked perfectly.
     
    Don-Gray likes this.
  3. Don-Gray

    Don-Gray

    Joined:
    Mar 18, 2009
    Posts:
    2,278
    Yes, thank you!
     
  4. Don-Gray

    Don-Gray

    Joined:
    Mar 18, 2009
    Posts:
    2,278
    Hmm, now I am getting this error:

    Assets/SteamVR/Editor/SteamVR_Settings.cs(105,49): error CS0117: `UnityEditorInternal.VR.VREditor' does not contain a definition for `InitializeVRPlayerSettingsForBuildTarget'

    Anyone?
     
  5. mimminito

    mimminito

    Joined:
    Feb 10, 2010
    Posts:
    780
    As its in beta the API's are changing. You need to change the 'InitializeVRPlayerSettings' to one of the other methods. It accepts a BuildTarget and a boolean to activate that platform. Sorry, I cant post the code as im not inside the 5.4 beta right now, ive gone back to Unity 5.3 for development instead.
     
  6. Don-Gray

    Don-Gray

    Joined:
    Mar 18, 2009
    Posts:
    2,278
    Okay, don't code so had to uninstall for now, thanks.
     
  7. greggtwep16

    greggtwep16

    Joined:
    Aug 17, 2012
    Posts:
    1,546
    You can safely comment out that line in Unity 5.4.

    Hopefully, sometime soon Valve will update their plugin on the store to fix these. The plugin will run fine on Unity 5.0 - 5.3, but in Unity 5.4 it will have the 2 compile errors mentioned (which can be fixed by the instructions in this thread. Valve also has some editor scripts to fix project settings and other things which unfortunately won't run until those compile errors are fixed so it is important to do so.

    Not using 5.4 is an easier experience, but there were a lot of performance improvements in 5.4 so it is generally recommended to use it if you can but until Valve updates you will have to fix those errors manually.
     
  8. Don-Gray

    Don-Gray

    Joined:
    Mar 18, 2009
    Posts:
    2,278
    thanks :)
     
  9. Don-Gray

    Don-Gray

    Joined:
    Mar 18, 2009
    Posts:
    2,278
    Version 1.0.6 works with no errors in Unity 5.4 b17, but I'm not seeing my controllers,
    must be more I have to do.
     
  10. mimminito

    mimminito

    Joined:
    Feb 10, 2010
    Posts:
    780
    New version 1.0.9 has just been released. Im going to try this soon with latest 5.4 beta.
     
  11. greggtwep16

    greggtwep16

    Joined:
    Aug 17, 2012
    Posts:
    1,546
  12. Don-Gray

    Don-Gray

    Joined:
    Mar 18, 2009
    Posts:
    2,278
    Yes, 1.0.9, not 1.0.6.