Esempio n. 1
0
    private static void SetConfigSDKMode(SdkMode mode)
    {
        var    roots  = MainScene.GetRootGameObjects();
        Config config = null;

        foreach (var root in roots)
        {
            if (root.GetComponent <App>() != null)
            {
                config = root.GetComponentInChildren <Config>();
                Undo.RecordObject(config, "Change Monoscopic SDK");
                config.m_SdkMode = mode;
                EditorUtility.SetDirty(config);
                EditorSceneManager.MarkSceneDirty(SceneManager.GetActiveScene());
                // TODO this failed to mark the scene as saved for some reason.
                // Better to let the user do it manually.
                // EditorSceneManager.SaveCurrentModifiedScenesIfUserWantsTo();
                break;
            }
        }
    }
Esempio n. 2
0
        private void BuildSetupGui()
        {
            GUILayoutOption[] options = new GUILayoutOption[]
            {
                GUILayout.ExpandHeight(true),
            };

            GUILayoutOption[] toggleOpt = new GUILayoutOption[]
            {
                GUILayout.Width(150),
            };

            using (var changeScope = new EditorGUI.ChangeCheckScope())
            {
                using (var setupBar = new GUILayout.HorizontalScope(GUILayout.Height(110)))
                {
                    // Sdk Modes
                    using (var sdkBar = new HeaderedVerticalLayout("VR SDK", options))
                    {
                        SdkMode[] sdks        = BuildTiltBrush.SupportedSdkModes();
                        SdkMode   selectedSdk = BuildTiltBrush.GuiSelectedSdk;
                        foreach (var sdk in sdks)
                        {
                            bool selected    = sdk == selectedSdk;
                            bool newSelected = GUILayout.Toggle(selected, sdk.ToString(), toggleOpt);
                            if (selected != newSelected)
                            {
                                BuildTiltBrush.GuiSelectedSdk = sdk;
                            }
                        }
                    }

                    // Platforms
                    using (var platformBar = new HeaderedVerticalLayout("Platform", options))
                    {
                        BuildTarget[] targets        = BuildTiltBrush.SupportedBuildTargets();
                        BuildTarget   selectedTarget = BuildTiltBrush.GuiSelectedBuildTarget;
                        SdkMode       selectedSdk    = BuildTiltBrush.GuiSelectedSdk;
                        foreach (var target in targets)
                        {
                            GUI.enabled = BuildTiltBrush.BuildTargetSupported(selectedSdk, target);
                            bool selected    = target == selectedTarget;
                            bool newSelected = GUILayout.Toggle(selected, target.ToString(), toggleOpt);
                            if (selected != newSelected)
                            {
                                BuildTiltBrush.GuiSelectedBuildTarget = target;
                            }
                        }
                        GUI.enabled = true;
                    }

                    // Runtime
                    using (var runtimeBar = new HeaderedVerticalLayout("Runtime", options))
                    {
                        bool isIl2cpp    = BuildTiltBrush.GuiRuntimeIl2cpp;
                        bool newIsMono   = GUILayout.Toggle(!isIl2cpp, "Mono", toggleOpt);
                        bool newIsIl2cpp = GUILayout.Toggle(isIl2cpp, "IL2CPP", toggleOpt);
                        if (isIl2cpp != newIsIl2cpp || isIl2cpp != !newIsMono)
                        {
                            BuildTiltBrush.GuiRuntimeIl2cpp = !isIl2cpp;
                        }
                    }

                    // Options
                    using (var optionsBar = new HeaderedVerticalLayout("Options", options))
                    {
                        BuildTiltBrush.GuiDevelopment =
                            GUILayout.Toggle(BuildTiltBrush.GuiDevelopment, "Development");
                        BuildTiltBrush.GuiExperimental =
                            GUILayout.Toggle(BuildTiltBrush.GuiExperimental, "Experimental");
                        BuildTiltBrush.GuiAutoProfile =
                            GUILayout.Toggle(BuildTiltBrush.GuiAutoProfile, "Auto Profile");
                    }
                }

                if (changeScope.changed)
                {
                    OnBuildSettingsChanged();
                }
            }
        }