Пример #1
0
        private void On_VREvent_Quit(API.VREvent_t pEvent)
        {
            if (exiting == true)
            {
                return;
            }
            exiting = true;

            if (API.OpenVR.System != null)
            {
                API.OpenVR.System.AcknowledgeQuit_Exiting();
            }

#if UNITY_EDITOR
            Debug.Log("<b>[OpenVR]</b> Quit requested from OpenVR. Exiting application via EditorApplication.isPlaying = false");
            UnityEditor.EditorApplication.isPlaying = false;
#else
            Debug.Log("<b>[OpenVR]</b> Quit requested from OpenVR. Exiting application via Application.Quit");
            Application.Quit();
#endif
        }
Пример #2
0
        public OpenVREvents(bool lazyLoadEvents = false)
        {
            instance = this;
            events   = new OpenVREvent[(int)API.EVREventType.VREvent_VendorSpecific_Reserved_End];

            vrEvent     = new API.VREvent_t();
            vrEventSize = (uint)System.Runtime.InteropServices.Marshal.SizeOf(typeof(API.VREvent_t));

            if (lazyLoadEvents == false)
            {
                for (int eventIndex = 0; eventIndex < events.Length; eventIndex++)
                {
                    events[eventIndex] = new OpenVREvent();
                }
            }
            else
            {
                preloadedEvents = true;
            }

            RegisterDefaultEvents();
        }