LinkLabel() static private méthode

static private LinkLabel ( GUIContent label ) : bool
label UnityEngine.GUIContent
Résultat bool
Exemple #1
0
 private static void ComponentBasedWorkflowButton()
 {
     GUILayout.BeginHorizontal();
     if (EditorGUILayout.LinkLabel(s_Styles.m_LearnAboutComponent))
     {
         Help.BrowseURL("https://github.com/Unity-Technologies/NavMeshComponents");
     }
     GUILayout.EndHorizontal();
 }
        private static void GUIBuildButtons(IBuildWindowExtension buildWindowExtension,
                                            bool enableBuildButton,
                                            bool enableBuildAndRunButton,
                                            bool canInstallInBuildFolder,
                                            BuildPlatform platform)
        {
            GUILayout.FlexibleSpace();


            if (canInstallInBuildFolder)
            {
                GUILayout.BeginHorizontal();
                EditorUserBuildSettings.installInBuildFolder = GUILayout.Toggle(EditorUserBuildSettings.installInBuildFolder, "Install in Builds folder\n(for debugging with source code)", GUILayout.ExpandWidth(false));

                var content = new GUIContent(EditorGUI.GUIContents.helpIcon);
                content.tooltip = "Open documentation for debugging source code";
                if (GUILayout.Button(content, EditorStyles.iconButton))
                {
                    var path = Path.Combine(Directory.GetParent(EditorApplication.applicationPath).FullName, "../../Documentation/BuildDocs/view_build_docs");
                    if (Application.platform == RuntimePlatform.WindowsEditor)
                    {
                        System.Diagnostics.Process.Start(path + ".cmd");
                    }
                    else
                    {
                        System.Diagnostics.Process.Start("/bin/bash", path);
                    }
                }
                GUILayout.EndHorizontal();
            }
            else
            {
                EditorUserBuildSettings.installInBuildFolder = false;
            }

            if ((buildWindowExtension != null) && Unsupported.IsSourceBuild())
            {
                buildWindowExtension.ShowInternalPlatformBuildOptions();
            }


            if (buildWindowExtension != null)
            {
                buildWindowExtension.ShowPlatformBuildWarnings();
            }

            // Disable the 'Build' and 'Build And Run' buttons when the project setup doesn't satisfy the platform requirements
            if (!IsColorSpaceValid(platform) && enableBuildButton && enableBuildAndRunButton)
            {
                enableBuildAndRunButton = false;
                enableBuildButton       = false;
                EditorGUILayout.HelpBox(styles.invalidColorSpaceMessage);
            }
            else if (!IsLightmapEncodingValid(platform) && enableBuildButton && enableBuildAndRunButton)
            {
                enableBuildAndRunButton = false;
                enableBuildButton       = false;
                EditorGUILayout.HelpBox(styles.invalidLightmapEncodingMessage);
            }

            if (EditorApplication.isCompiling || EditorApplication.isUpdating)
            {
                enableBuildAndRunButton = false;
                enableBuildButton       = false;
                EditorGUILayout.HelpBox(styles.compilingMessage);
            }
            GUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();
            if (EditorGUILayout.LinkLabel(styles.learnAboutUnityCloudBuild))
            {
                Application.OpenURL(string.Format("{0}/from/editor/buildsettings?upid={1}&pid={2}&currentplatform={3}&selectedplatform={4}&unityversion={5}",
                                                  UnityEditorInternal.WebURLs.cloudBuildPage, CloudProjectSettings.projectId, PlayerSettings.productGUID, EditorUserBuildSettings.activeBuildTarget, EditorUserBuildSettingsUtils.CalculateSelectedBuildTarget(), Application.unityVersion));
            }
            GUILayout.EndHorizontal();
            // Space 6 for alignment with platform column and to reduce missclicks with Build And Run button
            GUILayout.Space(6);

            GUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();

            GUIContent buildButton         = null;
            GUIContent buildAndRunButton   = null;
            bool       askForBuildLocation = true;

            if (buildWindowExtension != null)
            {
                buildWindowExtension.GetBuildButtonTitles(out buildButton, out buildAndRunButton);
                askForBuildLocation = buildWindowExtension.AskForBuildLocation();
            }

            buildButton       = buildButton ?? styles.build;
            buildAndRunButton = buildAndRunButton ?? styles.buildAndRun;

            // Switching build target in the editor
            BuildTarget      selectedTarget      = EditorUserBuildSettingsUtils.CalculateSelectedBuildTarget();
            BuildTargetGroup selectedTargetGroup = EditorUserBuildSettings.selectedBuildTargetGroup;

            bool selectedTargetIsActive = EditorUserBuildSettings.activeBuildTarget == selectedTarget &&
                                          EditorUserBuildSettings.activeBuildTargetGroup == selectedTargetGroup;

            if (selectedTargetIsActive)
            {
                // Build Button
                GUI.enabled = enableBuildButton;
                if (GUILayout.Button(buildButton, GUILayout.Width(Styles.kButtonWidth)))
                {
                    CallBuildMethods(askForBuildLocation, BuildOptions.ShowBuiltPlayer);
                    GUIUtility.ExitGUI();
                }
            }
            else
            {
                GUI.enabled = BuildPipeline.IsBuildTargetSupported(selectedTargetGroup, selectedTarget) && EditorUserBuildSettings.activeBuildTargetGroup != selectedTargetGroup;
                if (GUILayout.Button(styles.switchPlatform, GUILayout.Width(Styles.kButtonWidth)))
                {
                    EditorUserBuildSettings.SwitchActiveBuildTargetAsync(selectedTargetGroup, selectedTarget);
                    GUIUtility.ExitGUI();
                }
            }

            // Build and Run button
            GUI.enabled = enableBuildAndRunButton && selectedTargetIsActive;
            if (GUILayout.Button(buildAndRunButton, GUILayout.Width(Styles.kButtonWidth)))
            {
                BuildPlayerAndRun(askForBuildLocation);
                GUIUtility.ExitGUI();
            }

            GUILayout.EndHorizontal();
        }