Inheritance: System.IDisposable
Esempio n. 1
0
        private void Dispose(bool disposing)
        {
            SteamVR_Events.Initializing.Remove(OnInitializing);
            SteamVR_Events.Calibrating.Remove(OnCalibrating);
            SteamVR_Events.OutOfRange.Remove(OnOutOfRange);
            SteamVR_Events.DeviceConnected.Remove(OnDeviceConnected);
            SteamVR_Events.NewPoses.Remove(OnNewPoses);

            _instance = null;
        }
        private void OnEnable()
        {
            SteamVR instance = SteamVR.instance;

            if (instance == null)
            {
                if (this.head != null)
                {
                    this.head.GetComponent <SteamVR_GameView>().enabled      = false;
                    this.head.GetComponent <SteamVR_TrackedObject>().enabled = false;
                }
                if (this.flip != null)
                {
                    this.flip.enabled = false;
                }
                base.enabled = false;
                return;
            }
            this.Expand();
            if (SteamVR_Camera.blitMaterial == null)
            {
                SteamVR_Camera.blitMaterial = new Material(VRShaders.GetShader(VRShaders.VRShader.blit));
            }
            Camera component = base.GetComponent <Camera>();

            component.fieldOfView  = instance.fieldOfView;
            component.aspect       = instance.aspect;
            component.eventMask    = 0;
            component.orthographic = false;
            component.enabled      = false;
            if (component.actualRenderingPath != RenderingPath.Forward && QualitySettings.antiAliasing > 1)
            {
                Debug.LogWarning("MSAA only supported in Forward rendering path. (disabling MSAA)");
                QualitySettings.antiAliasing = 0;
            }
            Camera component2 = this.head.GetComponent <Camera>();

            if (component2 != null)
            {
                component2.renderingPath = component.renderingPath;
            }
            if (this.ears == null)
            {
                SteamVR_Ears componentInChildren = base.transform.GetComponentInChildren <SteamVR_Ears>();
                if (componentInChildren != null)
                {
                    this._ears = componentInChildren.transform;
                }
            }
            if (this.ears != null)
            {
                this.ears.GetComponent <SteamVR_Ears>().vrcam = this;
            }
            SteamVR_Render.Add(this);
        }
        private static string GetClassPath()
        {
            string path = Path.Combine(SteamVR.GetSteamVRFolderParentPath(), SteamVR_Settings.instance.steamVRInputPath);

            if (Directory.Exists(path) == false)
            {
                Directory.CreateDirectory(path);
            }

            return(path);
        }
Esempio n. 4
0
 public void InitializeSteamVR(bool forceUnityVRToOpenVR = false)
 {
     if (forceUnityVRToOpenVR)
     {
         throw new System.Exception("This should not be used");
     }
     else
     {
         SteamVR.Initialize(false);
     }
 }
        protected virtual void OnEnable()
        {
            SteamVR.Initialize();

            if (poseAction != null)
            {
                poseAction[inputSource].onUpdate += SteamVR_Behaviour_Pose_OnUpdate;
                poseAction[inputSource].onDeviceConnectedChanged += OnDeviceConnectedChanged;
                poseAction[inputSource].onTrackingChanged        += OnTrackingChanged;
                poseAction[inputSource].onChange += SteamVR_Behaviour_Pose_OnChange;
            }
        }
        private void OpenControllerBindings()
        {
            if (HasBeenModified())
            {
                bool saveFirst = EditorUtility.DisplayDialog("Save?", "It looks like you've made changes without saving. Would you like to save before editing the bindings?.", "Save", "Open without saving");
                if (saveFirst)
                {
                    SaveFile();
                }
            }

            SteamVR.ShowBindingsForEditor();
        }
Esempio n. 7
0
        /// <summary>
        /// Returns an array of positions/rotations that represent the state of each bone in a reference pose.
        /// </summary>
        /// <param name="referencePose">Which reference pose to return</param>
        public void ForceToReferencePose(EVRSkeletalReferencePose referencePose)
        {
            bool temporarySession = false;

            if (Application.isEditor && Application.isPlaying == false)
            {
                temporarySession = SteamVR.InitializeTemporarySession(true);
                Awake();

                skeletonAction.actionSet.Activate();

                SteamVR_ActionSet_Manager.UpdateActionStates(true);

                skeletonAction.UpdateValueWithoutEvents();
            }

            if (skeletonAction.active == false)
            {
                Debug.LogError("<b>[SteamVR_Standalone Input]</b> Please turn on your " + inputSource.ToString() + " controller and ensure SteamVR_Standalone is open.", this);
                return;
            }

            SteamVR_Utils.RigidTransform[] transforms = skeletonAction.GetReferenceTransforms(EVRSkeletalTransformSpace.Parent, referencePose);

            if (transforms == null || transforms.Length == 0)
            {
                Debug.LogError("<b>[SteamVR_Standalone Input]</b> Unable to get the reference transform for " + inputSource.ToString() + ". Please make sure SteamVR_Standalone is open and both controllers are connected.", this);
            }

            if (mirroring == MirrorType.LeftToRight || mirroring == MirrorType.RightToLeft)
            {
                for (int boneIndex = 0; boneIndex < transforms.Length; boneIndex++)
                {
                    bones[boneIndex].localPosition = MirrorPosition(boneIndex, transforms[boneIndex].pos);
                    bones[boneIndex].localRotation = MirrorRotation(boneIndex, transforms[boneIndex].rot);
                }
            }
            else
            {
                for (int boneIndex = 0; boneIndex < transforms.Length; boneIndex++)
                {
                    bones[boneIndex].localPosition = transforms[boneIndex].pos;
                    bones[boneIndex].localRotation = transforms[boneIndex].rot;
                }
            }

            if (temporarySession)
            {
                SteamVR.ExitTemporarySession();
            }
        }
Esempio n. 8
0
        protected virtual void Awake()
        {
            SteamVR.Initialize();

            AssignBonesArray();

            proximals = new Transform[] { thumbProximal, indexProximal, middleProximal, ringProximal, pinkyProximal };
            middles   = new Transform[] { thumbMiddle, indexMiddle, middleMiddle, ringMiddle, pinkyMiddle };
            distals   = new Transform[] { thumbDistal, indexDistal, middleDistal, ringDistal, pinkyDistal };
            tips      = new Transform[] { thumbTip, indexTip, middleTip, ringTip, pinkyTip };
            auxs      = new Transform[] { thumbAux, indexAux, middleAux, ringAux, pinkyAux };

            CheckSkeletonAction();
        }
Esempio n. 9
0
        private IEnumerator RenderLoop()
        {
            while (Application.isPlaying)
            {
                yield return(this.waitForEndOfFrame);

                if (!SteamVR_Render.pauseRendering)
                {
                    CVRCompositor compositor = OpenVR.Compositor;
                    if (compositor != null)
                    {
                        if (!compositor.CanRenderScene() || cameras.Length < 1)
                        {
                            continue;
                        }
                        compositor.SetTrackingSpace(SteamVR.settings.trackingSpace);
                        SteamVR_Utils.QueueEventOnRenderThread(201510020);
                        SteamVR.Unity.EventWriteString("[UnityMain] GetNativeTexturePtr - Begin");
                        SteamVR_Camera.GetSceneTexture(this.cameras[0].GetComponent <Camera>()).GetNativeTexturePtr();
                        SteamVR.Unity.EventWriteString("[UnityMain] GetNativeTexturePtr - End");
                        compositor.GetLastPoses(this.poses, this.gamePoses);
                        SteamVR_Events.NewPoses.Send(this.poses);
                        SteamVR_Events.NewPosesApplied.Send();
                    }
                    SteamVR_Overlay instance = SteamVR_Overlay.instance;
                    if (instance != null)
                    {
                        instance.UpdateOverlay();
                    }
                    if (this.CheckExternalCamera())
                    {
                        this.RenderExternalCamera();
                    }
                    SteamVR instance2 = SteamVR.instance;
                    this.RenderEye(instance2, EVREye.Eye_Left);
                    this.RenderEye(instance2, EVREye.Eye_Right);
                    foreach (SteamVR_Camera steamVR_Camera in this.cameras)
                    {
                        steamVR_Camera.transform.localPosition = Vector3.zero;
                        steamVR_Camera.transform.localRotation = Quaternion.identity;
                    }
                    if (this.cameraMask != null)
                    {
                        this.cameraMask.Clear();
                    }
                }
            }
            yield break;
        }
        void RenderEye(SteamVR vr, EVREye eye)
        {
            eyePreRenderCallback?.Invoke(eye);

            int i = (int)eye;

            SteamVR_Render.eye = eye;

            if (cameraMask != null)
            {
                cameraMask.Set(vr, eye);
            }

            foreach (var c in cameras)
            {
                c.transform.localPosition = vr.eyes[i].pos;
                c.transform.localRotation = vr.eyes[i].rot;

                // Update position to keep from getting culled
                cameraMask.transform.position = c.transform.position;

                var camera = c.camera;
                camera.targetTexture = SteamVR_Camera.GetSceneTexture(camera.allowHDR);
                int cullingMask = camera.cullingMask;
                if (eye == EVREye.Eye_Left)
                {
                    camera.cullingMask &= ~rightMask;
                    camera.cullingMask |= leftMask;
                }
                else
                {
                    camera.cullingMask &= ~leftMask;
                    camera.cullingMask |= rightMask;
                }
                camera.Render();

                if (SteamVR_Camera.doomp)
                {
                    Debug.Log(Time.frameCount.ToString() + $"/Render{eye}_OnRenderImage_src.png");
                    SteamVR_Camera.DumpRenderTexture(camera.targetTexture, Application.streamingAssetsPath + $"/Render{eye}_OnRenderImage_src.png");
                }
                camera.cullingMask = cullingMask;
            }
            eyePostRenderCallback?.Invoke(eye);
        }
Esempio n. 11
0
        public void InitializeSteamVR(bool forceUnityVRToOpenVR = false)
        {
            if (forceUnityVRToOpenVR)
            {
                forcingInitialization = true;

                if (initializeCoroutine != null)
                    StopCoroutine(initializeCoroutine);

                if (XRSettings.loadedDeviceName == openVRDeviceName)
                    EnableOpenVR();
                else
                    initializeCoroutine = StartCoroutine(DoInitializeSteamVR(forceUnityVRToOpenVR));
            }
            else
            {
                SteamVR.Initialize(false);
            }
        }
 public static void Initialize(bool forceUnityVRMode = false)
 {
     if (forceUnityVRMode)
     {
         SteamVR_Behaviour.instance.InitializeSteamVR(true);
         return;
     }
     if (SteamVR._instance == null)
     {
         SteamVR._instance = SteamVR.CreateInstance();
         if (SteamVR._instance == null)
         {
             SteamVR._enabled = false;
         }
     }
     if (SteamVR._enabled)
     {
         SteamVR_Behaviour.Initialize(forceUnityVRMode);
     }
 }
Esempio n. 13
0
        private static void LoadInstance()
        {
            if (_instance == null)
            {
                _instance = Resources.Load <SteamVR_Settings>("SteamVR_Settings");

                if (_instance == null)
                {
                    _instance = SteamVR_Settings.CreateInstance <SteamVR_Settings>();

#if UNITY_EDITOR
                    string localFolderPath = SteamVR.GetSteamVRResourcesFolderPath(true);
                    string assetPath       = System.IO.Path.Combine(localFolderPath, "SteamVR_Settings.asset");

                    UnityEditor.AssetDatabase.CreateAsset(_instance, assetPath);
                    UnityEditor.AssetDatabase.SaveAssets();
#endif
                }

                SetDefaultsIfNeeded();
            }
        }
Esempio n. 14
0
        public static void CopyFiles(bool force = false)
        {
            bool hasCopied = EditorPrefs.GetBool(steamVRInputExampleJSONCopiedKey, false);

            if (hasCopied == false || force == true)
            {
                string actionsFilePath = SteamVR_Input.GetActionsFilePath();
                bool   exists          = File.Exists(actionsFilePath);
                if (exists == false)
                {
                    string steamVRFolder     = SteamVR.GetSteamVRFolderPath();
                    string exampleLocation   = Path.Combine(steamVRFolder, exampleJSONFolderParent);
                    string exampleFolderPath = Path.Combine(exampleLocation, exampleJSONFolderName);

                    string streamingAssetsPath = SteamVR_Input.GetActionsFileFolder();

                    string[] files = Directory.GetFiles(exampleFolderPath, "*.json");
                    foreach (string file in files)
                    {
                        string filename = Path.GetFileName(file);

                        string newPath = Path.Combine(streamingAssetsPath, filename);

                        try
                        {
                            File.Copy(file, newPath, false);
                            Debug.Log("<b>[SteamVR]</b> Copied example input JSON to path: " + newPath);
                        }
                        catch
                        {
                            Debug.LogError("<b>[SteamVR]</b> Could not copy file: " + file + " to path: " + newPath);
                        }
                    }

                    EditorPrefs.SetBool(steamVRInputExampleJSONCopiedKey, true);
                }
            }
        }
Esempio n. 15
0
 public void InitializeSteamVR(bool forceUnityVRToOpenVR = false)
 {
     if (forceUnityVRToOpenVR)
     {
         SteamVR_Behaviour.forcingInitialization = true;
         if (this.initializeCoroutine != null)
         {
             this.StopCoroutine(this.initializeCoroutine);
         }
         if (XRSettings.loadedDeviceName == "OpenVR")
         {
             this.EnableOpenVR();
         }
         else
         {
             this.initializeCoroutine = this.StartCoroutine(this.DoInitializeSteamVR(forceUnityVRToOpenVR));
         }
     }
     else
     {
         SteamVR.Initialize(false);
     }
 }
        private static void SetDefaultsIfNeeded()
        {
            if (string.IsNullOrEmpty(_instance.editorAppKey))
            {
                _instance.editorAppKey = SteamVR.GenerateAppKey();
                Debug.Log("<b>[SteamVR Setup]</b> Generated you an editor app key of: " + _instance.editorAppKey + ". This lets the editor tell SteamVR what project this is. Has no effect on builds. This can be changed in Assets/SteamVR/Resources/SteamVR_Settings");
#if UNITY_EDITOR
                EditorUtility.SetDirty(_instance);
                AssetDatabase.SaveAssets();
#endif
            }

#if UNITY_EDITOR
            if (_instance.previewHandLeft == null)
            {
                _instance.previewHandLeft = FindDefaultPreviewHand(previewLeftDefaultAssetName);
            }

            if (_instance.previewHandRight == null)
            {
                _instance.previewHandRight = FindDefaultPreviewHand(previewRightDefaultAssetName);
            }
#endif
        }
        public static string GenerateAppKey()
        {
            string arg = SteamVR.GenerateCleanProductName();

            return(string.Format("application.generated.unity.{0}.exe", arg));
        }
Esempio n. 18
0
 private void EnableOpenVR()
 {
     XRSettings.enabled = true;
     SteamVR.Initialize(false);
     SteamVR_Behaviour.forcingInitialization = false;
 }
Esempio n. 19
0
 void OnApplicationQuit()
 {
     isQuitting = true;
     SteamVR.SafeDispose();
 }
Esempio n. 20
0
 private void OnApplicationQuit()
 {
     SteamVR_Render.isQuitting = true;
     SteamVR.SafeDispose();
 }
Esempio n. 21
0
        private void Update()
        {
            if (!SteamVR.active)
            {
                return;
            }
            this.UpdatePoses();
            CVRSystem system = OpenVR.System;

            if (system != null)
            {
                VREvent_t vrevent_t   = default(VREvent_t);
                uint      uncbVREvent = (uint)Marshal.SizeOf(typeof(VREvent_t));
                int       num         = 0;
                while (num < 64 && system.PollNextEvent(ref vrevent_t, uncbVREvent))
                {
                    EVREventType eventType = (EVREventType)vrevent_t.eventType;
                    if (eventType <= EVREventType.VREvent_InputFocusReleased)
                    {
                        if (eventType != EVREventType.VREvent_InputFocusCaptured)
                        {
                            if (eventType != EVREventType.VREvent_InputFocusReleased)
                            {
                                goto IL_CA;
                            }
                            if (vrevent_t.data.process.pid == 0u)
                            {
                                SteamVR_Events.InputFocus.Send(true);
                            }
                        }
                        else if (vrevent_t.data.process.oldPid == 0u)
                        {
                            SteamVR_Events.InputFocus.Send(false);
                        }
                    }
                    else if (eventType != EVREventType.VREvent_HideRenderModels)
                    {
                        if (eventType != EVREventType.VREvent_ShowRenderModels)
                        {
                            goto IL_CA;
                        }
                        SteamVR_Events.HideRenderModels.Send(false);
                    }
                    else
                    {
                        SteamVR_Events.HideRenderModels.Send(true);
                    }
IL_C4:
                    num++;
                    continue;
IL_CA:
                    SteamVR_Events.System((EVREventType)vrevent_t.eventType).Send(vrevent_t);
                    goto IL_C4;
                }
            }
            Application.targetFrameRate     = -1;
            Application.runInBackground     = true;
            QualitySettings.maxQueuedFrames = -1;
            QualitySettings.vSyncCount      = 0;
            if (SteamVR.settings.lockPhysicsUpdateRateToRenderFrequency && Time.timeScale > 0f)
            {
                SteamVR instance = SteamVR.instance;
                if (instance != null)
                {
                    Time.fixedDeltaTime = Time.timeScale / instance.hmd_DisplayFrequency;
                }
            }
        }
Esempio n. 22
0
        private void OnGUI()
        {
            if (headerLabelStyle == null)
            {
                headerLabelStyle = new GUIStyle(EditorStyles.boldLabel);
            }
            if (multiLineStyle == null)
            {
                multiLineStyle = new GUIStyle(EditorStyles.wordWrappedLabel);
            }
            if (smallMultiLineStyle == null)
            {
                smallMultiLineStyle           = new GUIStyle(EditorStyles.wordWrappedLabel);
                smallMultiLineStyle.fontSize  = EditorStyles.miniLabel.fontSize;
                smallMultiLineStyle.fontStyle = FontStyle.Italic;
            }

            if (folderName == null)
            {
                folderName = "SteamVR_" + SteamVR.GenerateCleanProductName();
            }

            SteamVR_Input.InitializeFile();
            EditorGUILayout.Space();


            EditorGUILayout.LabelField("Partial input bindings", headerLabelStyle);
            EditorGUILayout.LabelField(
                "When you create a partial bindings folder you can include that anywhere inside your asset package folder and it will automatically be found and imported to the user's project on load.",
                multiLineStyle);
            EditorGUILayout.LabelField("note: You can rename the folder but do not rename any files inside.",
                                       smallMultiLineStyle);

            EditorGUILayout.Space();
            EditorGUILayout.Space();

            folderName = EditorGUILayout.TextField("Name", folderName);

            EditorGUILayout.Space();

            version = EditorGUILayout.IntField("Version", version);
            EditorGUILayout.LabelField("note: only whole numbers", smallMultiLineStyle);

            EditorGUILayout.Space();

            overwriteOldActions = EditorGUILayout.Toggle("Overwrite old actions", overwriteOldActions);
            EditorGUILayout.LabelField(
                "If the person importing your asset package has a previous version of your package this determines whether or not to overwrite actions and bindings that have the same name.",
                smallMultiLineStyle);

            EditorGUILayout.Space();

            removeOldVersionActions =
                EditorGUILayout.Toggle("Remove unused actions from old versions", overwriteOldActions);
            EditorGUILayout.LabelField(
                "If the person importing your asset package has a previous version of your package that has actions that are not used in the new version of your package this determines whether or not to delete those actions.",
                smallMultiLineStyle);

            EditorGUILayout.Space();
            EditorGUILayout.Space();

            bool create = GUILayout.Button("Create");

            if (create)
            {
                SteamVR_Input_ActionManifest_Manager.CreatePartial(folderName, version, overwriteOldActions,
                                                                   removeOldVersionActions);
            }
        }
        /// <summary>
        /// Returns an array of positions/rotations that represent the state of each bone in a reference pose.
        /// </summary>
        /// <param name="referencePose">Which reference pose to return</param>
        public void ForceToReferencePose(EVRSkeletalReferencePose referencePose)
        {
            bool temporarySession = false;

            if (Application.isEditor && Application.isPlaying == false)
            {
                temporarySession = SteamVR.InitializeTemporarySession(true);
                Awake();

#if UNITY_EDITOR
                //gotta wait a bit for steamvr input to startup //todo: implement steamvr_input.isready
                string title     = "SteamVR";
                string text      = "Getting reference pose...";
                float  msToWait  = 3000;
                float  increment = 100;
                for (float timer = 0; timer < msToWait; timer += increment)
                {
                    bool cancel = UnityEditor.EditorUtility.DisplayCancelableProgressBar(title, text, timer / msToWait);
                    if (cancel)
                    {
                        UnityEditor.EditorUtility.ClearProgressBar();

                        if (temporarySession)
                        {
                            SteamVR.ExitTemporarySession();
                        }
                        return;
                    }
                    System.Threading.Thread.Sleep((int)increment);
                }
                UnityEditor.EditorUtility.ClearProgressBar();
#endif

                skeletonAction.actionSet.Activate();

                SteamVR_ActionSet_Manager.UpdateActionStates(true);

                skeletonAction.UpdateValueWithoutEvents();
            }

            if (skeletonAction.active == false)
            {
                Debug.LogError("<b>[SteamVR Input]</b> Please turn on your " + inputSource.ToString() + " controller and ensure SteamVR is open.");
                return;
            }

            SteamVR_Utils.RigidTransform[] transforms = skeletonAction.GetReferenceTransforms(EVRSkeletalTransformSpace.Parent, referencePose);

            if (transforms == null || transforms.Length == 0)
            {
                Debug.LogError("<b>[SteamVR Input]</b> Unable to get the reference transform for " + inputSource.ToString() + ". Please make sure SteamVR is open and both controllers are connected.");
            }

            for (int boneIndex = 0; boneIndex < transforms.Length; boneIndex++)
            {
                bones[boneIndex].localPosition = transforms[boneIndex].pos;
                bones[boneIndex].localRotation = transforms[boneIndex].rot;
            }

            if (temporarySession)
            {
                SteamVR.ExitTemporarySession();
            }
        }
Esempio n. 24
0
        public static bool GetBounds(Size size, ref HmdQuad_t pRect)
        {
            if (size == Size.Calibrated)
            {
                bool temporarySession = false;
                if (Application.isEditor && Application.isPlaying == false)
                {
                    temporarySession = SteamVR.InitializeTemporarySession();
                }

                var  chaperone = OpenVR.Chaperone;
                bool success   = (chaperone != null) && chaperone.GetPlayAreaRect(ref pRect);
                if (!success)
                {
                    Debug.LogWarning(
                        "<b>[SteamVR]</b> Failed to get Calibrated Play Area bounds!  Make sure you have tracking first, and that your space is calibrated.");
                }

                if (temporarySession)
                {
                    SteamVR.ExitTemporarySession();
                }

                return(success);
            }
            else
            {
                try
                {
                    var str = size.ToString().Substring(1);
                    var arr = str.Split(new char[] { 'x' }, 2);

                    // convert to half size in meters (from cm)
                    var x = float.Parse(arr[0]) / 200;
                    var z = float.Parse(arr[1]) / 200;

                    pRect.vCorners0.v0 = x;
                    pRect.vCorners0.v1 = 0;
                    pRect.vCorners0.v2 = -z;

                    pRect.vCorners1.v0 = -x;
                    pRect.vCorners1.v1 = 0;
                    pRect.vCorners1.v2 = -z;

                    pRect.vCorners2.v0 = -x;
                    pRect.vCorners2.v1 = 0;
                    pRect.vCorners2.v2 = z;

                    pRect.vCorners3.v0 = x;
                    pRect.vCorners3.v1 = 0;
                    pRect.vCorners3.v2 = z;

                    return(true);
                }
                catch
                {
                }
            }

            return(false);
        }
 private static SteamVR CreateInstance()
 {
     SteamVR.initializedState = SteamVR.InitializedStates.Initializing;
     try
     {
         EVRInitError evrinitError = EVRInitError.None;
         OpenVR.GetGenericInterface("IVRCompositor_022", ref evrinitError);
         OpenVR.Init(ref evrinitError, EVRApplicationType.VRApplication_Scene, "");
         CVRSystem           system              = OpenVR.System;
         string              manifestFile        = SteamVR.GetManifestFile();
         EVRApplicationError evrapplicationError = OpenVR.Applications.AddApplicationManifest(manifestFile, true);
         if (evrapplicationError != EVRApplicationError.None)
         {
             UnityEngine.Debug.LogError("<b>[SteamVR_Standalone]</b> Error adding vr manifest file: " + evrapplicationError.ToString());
         }
         int id = Process.GetCurrentProcess().Id;
         OpenVR.Applications.IdentifyApplication((uint)id, SteamVR_Settings.instance.editorAppKey);
         UnityEngine.Debug.Log("Is HMD here? " + OpenVR.IsHmdPresent().ToString());
         if (evrinitError != EVRInitError.None)
         {
             SteamVR.initializedState = SteamVR.InitializedStates.InitializeFailure;
             SteamVR.ReportError(evrinitError);
             SteamVR.ReportGeneralErrors();
             SteamVR_Events.Initializing.Send(false);
             return(null);
         }
         OpenVR.GetGenericInterface("IVROverlay_021", ref evrinitError);
         if (evrinitError != EVRInitError.None)
         {
             SteamVR.initializedState = SteamVR.InitializedStates.InitializeFailure;
             SteamVR.ReportError(evrinitError);
             SteamVR_Events.Initializing.Send(false);
             return(null);
         }
         OpenVR.GetGenericInterface("IVRInput_007", ref evrinitError);
         if (evrinitError != EVRInitError.None)
         {
             SteamVR.initializedState = SteamVR.InitializedStates.InitializeFailure;
             SteamVR.ReportError(evrinitError);
             SteamVR_Events.Initializing.Send(false);
             return(null);
         }
         SteamVR.settings = SteamVR_Settings.instance;
         if (Application.isEditor)
         {
             SteamVR.IdentifyEditorApplication(true);
         }
         SteamVR_Input.IdentifyActionsFile(true);
         if (SteamVR_Settings.instance.inputUpdateMode != SteamVR_UpdateModes.Nothing || SteamVR_Settings.instance.poseUpdateMode != SteamVR_UpdateModes.Nothing)
         {
             SteamVR_Input.Initialize(false);
         }
     }
     catch (Exception arg)
     {
         UnityEngine.Debug.LogError("<b>[SteamVR_Standalone]</b> " + arg);
         SteamVR_Events.Initializing.Send(false);
         return(null);
     }
     SteamVR._enabled         = true;
     SteamVR.initializedState = SteamVR.InitializedStates.InitializeSuccess;
     SteamVR_Events.Initializing.Send(true);
     return(new SteamVR());
 }