[RectangleSpace]

Attribute used for reserving a rectangle area for custom GUI drawing via callback method.

Parameters

Parameter Name
Arguments
Description

name

string

Name of the callback method. Format: void OnGUI(Rect position).

Height

float

Height of the rectangle space in pixels.

GetHeightCallback

string

Name of method that returns dynamic height. Format: float GetHeight().

Examples

[RectangleSpace("OnDrawRect")]
public string customSpace;

private void OnDrawRect(Rect position)
{
    GUI.Label(position, "Custom GUI Element");
}

[RectangleSpace("OnDrawRect", Height = 50)]
public int fixedHeightSpace;

[RectangleSpace("OnDrawRect", GetHeightCallback = "GetSpaceHeight")]
public float dynamicHeightSpace;

private float GetSpaceHeight()
{
    return 40.0f;
}

Last updated