예제 #1
0
        private void Awake()
        {
            // Only allow one instance at runtime.
            if (instance != null)
            {
                enabled = false;
                DestroyImmediate(this);
                return;
            }

            instance = this;

            Debug.Log("Unity v" + Application.unityVersion + ", " +
                      "Oculus Utilities v" + OVRPlugin.wrapperVersion + ", " +
                      "OVRPlugin v" + OVRPlugin.version + ", " +
                      "SDK v" + OVRPlugin.nativeSDKVersion + ".");

#if UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN
            var supportedTypes =
                UnityEngine.Rendering.GraphicsDeviceType.Direct3D11.ToString() + ", " +
                UnityEngine.Rendering.GraphicsDeviceType.Direct3D12.ToString();

            if (!supportedTypes.Contains(SystemInfo.graphicsDeviceType.ToString()))
            {
                Debug.LogWarning("VR rendering requires one of the following device types: (" + supportedTypes + "). Your graphics device: " + SystemInfo.graphicsDeviceType.ToString());
            }
#endif

            // Detect whether this platform is a supported platform
            RuntimePlatform currPlatform = Application.platform;
            isSupportedPlatform |= currPlatform == RuntimePlatform.Android;
            //isSupportedPlatform |= currPlatform == RuntimePlatform.LinuxPlayer;
            isSupportedPlatform |= currPlatform == RuntimePlatform.OSXEditor;
            isSupportedPlatform |= currPlatform == RuntimePlatform.OSXPlayer;
            isSupportedPlatform |= currPlatform == RuntimePlatform.WindowsEditor;
            isSupportedPlatform |= currPlatform == RuntimePlatform.WindowsPlayer;
            if (!isSupportedPlatform)
            {
                Debug.LogWarning("This platform is unsupported");
                return;
            }

#if UNITY_ANDROID && !UNITY_EDITOR
            // We want to set up our touchpad messaging system
            OVRTouchpad.Create();

            // Turn off chromatic aberration by default to save texture bandwidth.
            chromatic = false;
#endif

            Initialize();

            if (resetTrackerOnLoad)
            {
                display.RecenterPose();
            }

            // Disable the occlusion mesh by default until open issues with the preview window are resolved.
            OVRPlugin.occlusionMesh = false;
        }
예제 #2
0
 public void OnDisable()
 {
     OVRTouchpad.OnDisable();
 }
예제 #3
0
 void Update()
 {
     OVRTouchpad.Update();
 }