Ejemplo n.º 1
0
        internal static GUIContent TextContent(string textAndTooltip)
        {
            if (textAndTooltip == null)
            {
                textAndTooltip = string.Empty;
            }
            GUIContent gUIContent = (GUIContent)EditorGUIUtility.s_TextGUIContents[textAndTooltip];

            if (gUIContent == null)
            {
                string[] nameAndTooltipString = EditorGUIUtility.GetNameAndTooltipString(textAndTooltip);
                gUIContent = new GUIContent(nameAndTooltipString[1]);
                if (nameAndTooltipString[2] != null)
                {
                    gUIContent.tooltip = nameAndTooltipString[2];
                }
                EditorGUIUtility.s_TextGUIContents[textAndTooltip] = gUIContent;
            }
            return(gUIContent);
        }
Ejemplo n.º 2
0
        public static GUIContent IconContent(string name, [DefaultValue("null")] string tooltip)
        {
            GUIContent gUIContent = (GUIContent)EditorGUIUtility.s_IconGUIContents[name];

            if (gUIContent != null)
            {
                return(gUIContent);
            }
            gUIContent = new GUIContent();
            if (tooltip != null)
            {
                string[] nameAndTooltipString = EditorGUIUtility.GetNameAndTooltipString(tooltip);
                if (nameAndTooltipString[2] != null)
                {
                    gUIContent.tooltip = nameAndTooltipString[2];
                }
            }
            gUIContent.image = EditorGUIUtility.LoadIconRequired(name);
            EditorGUIUtility.s_IconGUIContents[name] = gUIContent;
            return(gUIContent);
        }