private void RenderBuildAndRunning() { EditorGUILayout.LabelField(new GUIContent("Building & Running (" + _currentMode.ToString() + ")", "Building and optionally auto-running builds."), EditorStyles.centeredGreyMiniLabel); EditorGUI.BeginChangeCheck(); _buildTarget = (BuildTarget)EditorGUILayout.EnumPopup(new GUIContent("Build Target", "Which platform to build for."), _buildTarget); if (EditorGUI.EndChangeCheck()) { BuildScriptPrefs.SetBuildTarget(_buildTarget); } EditorGUI.BeginChangeCheck(); _devBuild = EditorGUILayout.Toggle(new GUIContent("Development Build", "Toggle to build as development build."), _devBuild); if (EditorGUI.EndChangeCheck()) { BuildScriptPrefs.SetDevelopmentBuild(_devBuild); } EditorGUI.BeginChangeCheck(); _buildAndRun = EditorGUILayout.Toggle(new GUIContent("Build and Run?", "Whether to auto-run the game after building, if successful."), _buildAndRun); if (EditorGUI.EndChangeCheck()) { BuildScriptPrefs.SetBuildAndRun(_buildAndRun); } // Actual mode pages switch (_currentMode) { case BuildMode.Singleplayer: { OnSingleplayerGUI(); break; } case BuildMode.Client: { OnClientGUI(); break; } case BuildMode.Server: { OnServerGUI(); break; } } // vr mode using (var vrrow = new EditorGUILayout.HorizontalScope()) { GUI.enabled = !Application.isPlaying; var vrSupport = EditorGUILayout.Toggle("VR Mode", PlayerSettings.virtualRealitySupported); if (!Application.isPlaying) { PlayerSettings.virtualRealitySupported = vrSupport; } GUI.enabled = true; // buttons for VR platform definition - easier to access than player settings var supDevices = UnityEngine.XR.XRSettings.supportedDevices; var goodColor = Color.green; var badColor = Color.red; GUI.color = supDevices.Contains("OpenVR") ? goodColor : badColor; if (GUILayout.Button("OpenVR")) { if (supDevices.Contains("OpenVR")) { // do nothing... } else { // add a new array containing only OpenVR var buildTargetGroup = BuildPipeline.GetBuildTargetGroup(this._buildTarget); UnityEditorInternal.VR.VREditor.SetVREnabledDevicesOnTargetGroup(buildTargetGroup, new string[] { "OpenVR" }); } } GUI.color = supDevices.Contains("Oculus") ? goodColor : badColor; if (GUILayout.Button("Oculus")) { if (supDevices.Contains("Oculus")) { // do nothing... } else { // add a new array containing only Oculus var buildTargetGroup = BuildPipeline.GetBuildTargetGroup(this._buildTarget); UnityEditorInternal.VR.VREditor.SetVREnabledDevicesOnTargetGroup(buildTargetGroup, new string[] { "Oculus" }); } } GUI.color = Color.white; } }