[OnRectangleSpace]

Attribute displays a method as a custom GUI rectangle area.

Support Types

Type
Description

Method

Supported method type

Parameters

Parameter Name
Type
Description

Title

string

Title of the rectangle space.

ShowTitle

bool

Show the title of the rectangle space.

ShowBackground

bool

Show the background of the rectangle space.

Height

float

Fixed height of the rectangle space.

GetHeight

string

Dynamic height callback for the rectangle space.

Style

string

Style of the rectangle space.

MarginTop

int

Margin top of the rectangle space.

MarginBottom

int

Margin bottom of the rectangle space.

Examples

[OnRectangleSpace(GetHeight = "GetCodeHeight", MarginTop = 10)]
public void DrawRectangleSpace(Rect position)
{
    // Custom GUI drawing code here
    GUI.Box(position, "Custom Space");
}

public float GetCodeHeight()
{
    return 50f;
}

Last updated