コード例 #1
0
        protected override void Awake()
        {
            base.Awake();


            aRSession = FindObjectOfType <ARSessionManager>();
            measure   = FindObjectOfType <MeasureHeight>();

            targetDevice = null;
            if (XRSettings.supportedDevices == null || XRSettings.supportedDevices.Length == 0)
            {
                // サポートしているデバイスがない場合は、直ちに復帰する。
                return;
            }

#if UNITY_STANDALONE_WIN
            if (XRSettings.supportedDevices.Any(i => i == DeviceHTCVive))
            {
                targetDevice = DeviceHTCVive;

                vrCamera?.SetActive(false);
                rightController.SetActive(false);
                leftController.SetActive(false);
                gamepad.SetActive(false);

                ActivateSelf(true);
            }
#elif UNITY_IOS
            // iPadはVR機能を有効化しない
            if (!SystemInfo.deviceModel.Contains("iPad"))
            {
                if (XRSettings.supportedDevices.Any(i => i == DeviceCardboard))
                {
                    targetDevice = DeviceCardboard;
                    touchPanel.gameObject.SetActive(false);
                }
            }
#else
            // NOP
#endif
        }
コード例 #2
0
 protected override void Awake()
 {
     base.Awake();
     _arFaceManager    = _arFaceManager ?? FindObjectOfType <ARFaceManager>();
     _arSessionManager = _arSessionManager ?? FindObjectOfType <ARSessionManager>();
 }