UnityEditor.Graphs.Styles.FindContent C# (CSharp) Method

FindContent() private static method

private static FindContent ( string contentName ) : GUIContent
contentName string
return UnityEngine.GUIContent
        private static GUIContent FindContent(string contentName)
        {
            Texture image = null;
            if (EditorGUIUtility.isProSkin)
            {
                image = EditorGUIUtility.Load("Graph/Dark/" + contentName) as Texture;
            }
            if (image == null)
            {
                image = EditorGUIUtility.Load("Graph/Light/" + contentName) as Texture;
            }
            if (image == null)
            {
                Debug.LogError("Unable to load " + contentName);
                return new GUIContent(contentName);
            }
            return new GUIContent(image);
        }

Usage Example

Beispiel #1
0
 static Styles()
 {
     Styles.graphBackground           = "flow background";
     Styles.connectionTexture         = Styles.FindContent("flow connection texture.png");
     Styles.selectedConnectionTexture = Styles.FindContent("flow selected connection texture.png");
     Styles.varPinIn         = "flow varPin in";
     Styles.varPinOut        = "flow varPin out";
     Styles.varPinTooltip    = "flow varPin tooltip";
     Styles.targetPinIn      = "flow target in";
     Styles.triggerPinIn     = "flow triggerPin in";
     Styles.triggerPinOut    = "flow triggerPin out";
     Styles.selectionRect    = "SelectionRect";
     Styles.nodeTitlebar     = "flow node titlebar";
     Styles.nodeAddButton    = "Label";
     Styles.m_NodeStyleCache = new Dictionary <string, GUIStyle>();
     Styles.nodeGroupButton  = new GUIStyle(EditorStyles.toolbarButton)
     {
         alignment = TextAnchor.MiddleLeft
     };
 }