UnityEngine.GUIGridSizer.GetRect C# (CSharp) Method

GetRect() public static method

public static GetRect ( GUIContent contents, int xCount, GUIStyle style, GUILayoutOption options ) : Rect
contents GUIContent
xCount int
style GUIStyle
options GUILayoutOption
return Rect
        public static Rect GetRect(GUIContent[] contents, int xCount, GUIStyle style, GUILayoutOption[] options)
        {
            Rect rect = new Rect(0f, 0f, 0f, 0f);
            switch (Event.current.type)
            {
                case EventType.Layout:
                    GUILayoutUtility.current.topLevel.Add(new GUIGridSizer(contents, xCount, style, options));
                    return rect;

                case EventType.Used:
                    return GUILayoutEntry.kDummyRect;
            }
            return GUILayoutUtility.current.topLevel.GetNext().rect;
        }

Usage Example

コード例 #1
0
ファイル: GUILayout.cs プロジェクト: zvars/UnityCsReference
 // Make a Selection Grid
 public static int SelectionGrid(int selected, GUIContent[] contents, int xCount, GUIStyle style, params GUILayoutOption[] options)
 {
     return(GUI.SelectionGrid(GUIGridSizer.GetRect(contents, xCount, style, options), selected, contents, xCount, style));
 }