private BuildTargetGroup GetBuildTargetForEmulatorDevice(VREmulatorDevice device) { switch (device) { case VREmulatorDevice.Daydream: case VREmulatorDevice.GearVR: return(BuildTargetGroup.Android); default: return(BuildTargetGroup.Unknown); } }
/// <summary> /// Creates the device implementation for the specified emulation method. /// </summary> /// <param name="device">The <see cref="VREmulatorDevice"/> type.</param> /// <returns>The <see cref="IVRDevice"/> implementation for the specified device.</returns> private IVRDevice CreateDeviceImplementation(VREmulatorDevice device) { switch (device) { case VREmulatorDevice.GearVR: return(new GearVR.GearVRDevice()); case VREmulatorDevice.Daydream: default: return(new DaydreamView.DaydreamViewDevice()); } }
private VRControllerVisual CreateEditorPreivew(VREmulatorDevice device) { switch (device) { case VREmulatorDevice.Daydream: return(DaydreamView.DaydreamEditorUtils.CreatePreviewControllerVisual()); case VREmulatorDevice.GearVR: return(GearVR.GearVREditorUtils.CreatePreviewControllerVisual()); } return(null); }
#pragma warning restore 0649 #endregion /// <summary> /// Creates a new emulator device. /// </summary> /// <param name="device">The emulator device type.</param> public EmulatorDevice(VREmulatorDevice device) { if (!Enum.IsDefined(typeof(VREmulatorDevice), device)) { UnityEngine.Debug.LogFormat("[EmulatorDevice] No VREmulatorSetup supplied, using default device ({0}).", _defaultDevice.ToString()); mImpl = CreateDeviceImplementation(_defaultDevice); } else { mImpl = CreateDeviceImplementation(device); } UnityEngine.Debug.LogFormat("[EmulatorDevice] Using device implementation: {0}", mImpl.GetType().Name); }
private void UpdatePreview() { if (Application.isPlaying) { DestroyPreview(); return; } if (mEmulator == null) { mEmulator = FindObjectOfType <VREmulator>(); } if (mEmulator == null) { return; } // Do we need to create a new preview? // Only if th device has changed, or there is currently no preview visible if (mEmulator.EmulatorDevice == mPreviewDevice && mPreviewVisual != null) { return; } DestroyPreview(); mPreviewDevice = mEmulator.EmulatorDevice; mPreviewVisual = CreateEditorPreivew(mPreviewDevice); if (mPreviewVisual != null) { mPreviewVisual.transform.SetParentAndIdentity(transform); mPreviewVisual.gameObject.hideFlags = HideFlags.HideAndDontSave | HideFlags.NotEditable; mPreviewVisual.gameObject.SetActive(true); // Hide any pointer visuals, because they can be annoying! foreach (var ptrVis in mPreviewVisual.GetComponentsInChildren <LaserPointerVisual>(true)) { ptrVis.gameObject.SetActive(false); } } }
private void DrawPlatformWarningForEmulatorDevice(VREmulatorDevice device) { var buildTarget = GetBuildTargetForEmulatorDevice(device); if (buildTarget == BuildTargetGroup.Unknown) { return; } // Build targets match, we're ok... if (buildTarget == EditorUserBuildSettings.selectedBuildTargetGroup) { return; } EditorGUILayout.Space(); EditorGUILayout.HelpBox( string.Format("This emulation device requires the build target to be set to '{0}'", buildTarget), MessageType.Warning ); }