UnityEngine.GUISkin.FindStyle C# (CSharp) Method

FindStyle() public method

Try to search for a GUIStyle. This functions returns NULL and does not give an error.

public FindStyle ( string styleName ) : GUIStyle
styleName string
return GUIStyle
        public GUIStyle FindStyle(string styleName)
        {
            GUIStyle style2;
            if (this == null)
            {
                Debug.LogError("GUISkin is NULL");
                return null;
            }
            if (this.m_Styles == null)
            {
                this.BuildStyleCache();
            }
            if (this.m_Styles.TryGetValue(styleName, out style2))
            {
                return style2;
            }
            return null;
        }

Usage Example

コード例 #1
0
ファイル: GuiModalWindow.cs プロジェクト: happyjiahan/colorus
    public void setProperties(Rect windowContentRect, GUIContent windowGuiContent, GUISkin skin,
				Action doMyWindowMethod, Action onExitByEscOrClose, Action onClickOutsideOfWindow)
    {
        if (windowStyle==null)
            windowStyle = skin.FindStyle(windowStyleName);
        closeButtonStyle = skin.FindStyle(closeButtonStyleName);
        this.doMyWindowMethod = doMyWindowMethod;
        this.onExitByEscOrClose = onExitByEscOrClose;
        this.onClickOutsideOfWindow = onClickOutsideOfWindow;
        this.skin = skin;
        this.windowGuiContent = windowGuiContent;

        windowRect = new Rect ( windowContentRect.x - windowStyle.padding.left,
                        windowContentRect.y - windowStyle.padding.top,
                        windowContentRect.width + windowStyle.padding.horizontal,
                        windowContentRect.height + windowStyle.padding.vertical);
        windowContentRect.x = windowStyle.padding.left;
        windowContentRect.y = windowStyle.padding.top;
        this.windowContentRect = windowContentRect;
        this.windowDragHeight = windowStyle.padding.top;

        updateDragRect();
        closeButtonHeight = closeButtonStyle.normal.background.height - closeButtonStyle.overflow.vertical;
        closeButtonWidth = closeButtonStyle.normal.background.width - closeButtonStyle.overflow.horizontal;

        int top = 8;
        int left = (int)( windowRect.width - closeButtonWidth) - 12;

        closeButtonRect = new Rect(left,
            top,
            closeButtonWidth,
            closeButtonHeight);
    }
All Usage Examples Of UnityEngine.GUISkin::FindStyle