Get RAPTOR

RaptorSuiteControls

Suite-style controls for tools in other assemblies, such as RAPTOR Render's Ray-traced preview settings.

NamespaceAssemblyKindStability
Raptor.EditorToolsRaptor.Editorclasspreview, since 0.1.0

Each member forwards to RaptorSuiteTheme, RaptorSuiteSettingsPage or RaptorSuiteStepField, where the look is defined.

public static class RaptorSuiteControls

Fields

ActionChipGap

public const float ActionChipGap;

The gap between an empty state's message row and its action chip, in points. It matches the panel button gap.

ActionChipHeight

public const float ActionChipHeight;

The height of the RAPTOR action chip and of an empty state's message row, in points.

CategoryGap

public const float CategoryGap;

The space above a folding category header.

CategoryHeight

public const float CategoryHeight;

The height of a folding category header.

ContextChipSize

public const float ContextChipSize;

The side length of a context bar icon button.

ContextGlyph

public const float ContextGlyph;

The glyph size of a context bar icon button.

ControlHeight

public const float ControlHeight;

The height of a tile, chip or fused row.

ControlRadius

public const float ControlRadius;

A control's corner radius.

EmptyGlyph

public const string EmptyGlyph;

The empty-state glyph, a dashed box (nv-square-dashed).

FieldHeight

public const float FieldHeight;

The height of a number field in a form. Inspector rows use 24.

FoldSeconds

public const float FoldSeconds;

The category fold duration, in seconds.

FormGap

public const float FormGap;

The gap after a form row's label column.

FormLabelWidth

public const float FormLabelWidth;

The width of a form row's label column.

FormRowHeight

public const float FormRowHeight;

The height of a form row.

GroupLabelGap

public const float GroupLabelGap;

The space above a group label.

GroupLabelHeight

public const float GroupLabelHeight;

The height of a group label.

HeadChipHeight

public const float HeadChipHeight;

The height of a tool panel's head chip.

IconButtonSize

public const float IconButtonSize;

The side length of a bare icon button.

IconButtonSmall

public const float IconButtonSmall;

The side length of a small bare icon button, as used in the bottom bar and panel headers.

LockedGlyph

public const string LockedGlyph;

The locked chip's glyph, the Suite's Locked icon (st-locked).

ModuleGap

public const float ModuleGap;

The gap between tiles, and between label rows.

ModulePadLeft

public const float ModulePadLeft;

A tool panel's left margin.

ModulePadRight

public const float ModulePadRight;

A tool panel's right margin, including the scrollbar gutter.

PanelFieldHeight

public const float PanelFieldHeight;

The height of a number field in a label row.

PanelRadius

public const float PanelRadius;

A panel's corner radius.

PanelRowHeight

public const float PanelRowHeight;

The height of a label row.

PanelRowLabel

public const float PanelRowLabel;

The width of a label row's label column.

TagHeight

public const float TagHeight;

The height of a dark thumbnail tag, in points. An icon-only tag is also this wide.

TickGap

public const float TickGap;

The gap between tick boxes on one row.

TickHeight

public const float TickHeight;

The height of a tick box row.

Properties

InputText

public static GUIStyle InputText { get; }

The text style inside an InputBox. It is based on the label style, so Unity's field skin does not draw a second box.

PanelLabel

public static GUIStyle PanelLabel { get; }

The 13 pt secondary text style for setting labels on tool panels.

QuietTileFill

public static bool QuietTileFill { get; set; }

Whether tiles have a quiet fill at rest. Always on: the choice left Settings, and a stored value is not read. A set lasts for the session.

Surface

public static Color Surface { get; }

The panel background colour. It is the docked panel colour, or the drawer colour while the panel is shown in a drawer.

Methods

ActionButton

public static bool ActionButton(Rect r, string words, string iconGlyph, bool enabled = true, string tooltip = null)

Draws an in-panel action button with a left-aligned glyph and label on a Suite chip. The ink is white when the button is enabled.

ParameterTypeDefaultDescription
rRectThe rect in GUI coordinates of the current view.
wordsstringThe label.
iconGlyphstringThe icon name.
enabledbooltrueWhether the button is enabled. A disabled button is dimmed and ignores clicks.
tooltipstringnullThe tooltip, or null.

Returns: True when clicked.

AskName

public static bool AskName(string title, string initial, string action, System.Func<string, string> run)

Shows a single-field name dialog inside the Suite, as used for RAPTOR Light presets.

ParameterTypeDescription
titlestringThe dialog's title.
initialstringThe starting text.
actionstringThe confirm button label.
runSystem.Func<string, string>Receives the trimmed name and returns null to accept it, or an error message to show under the field.

Returns: False when no Suite is open to host the dialog.

Button

public static bool Button(Rect r, string label, string iconGlyph = null)

Draws a secondary button in the Settings page style.

ParameterTypeDefaultDescription
rRectThe rect in GUI coordinates of the current view.
labelstringThe label.
iconGlyphstringnullThe icon name, or null.

Returns: True when clicked.

CapsRow

public static float CapsRow(Rect row, bool shown, Action<Rect> draw, float gap = ActionChipGap)

Draws the row only when shown is true. The bool form of CapsRow{T}.

ParameterTypeDefaultDescription
rowRectThe row's rect.
shownboolWhether to draw the row.
drawAction<Rect>Draws the row.
gapfloatActionChipGapThe gap after the row.

Returns: The row's height plus gap, or 0 when the row is hidden.

CapsRow

public static float CapsRow<T>(Rect row, T caps, T need, Action<Rect> draw, float gap = ActionChipGap) where T : struct, Enum

Draws a row only when the active backend supports it. If caps has every flag in need, calls draw with row. Add the returned height to your y position. An unsupported row is not shown and takes no space.

ParameterTypeDefaultDescription
rowRectThe row's rect.
capsTThe active backend's capabilities.
needTThe flags the row needs.
drawAction<Rect>Draws the row.
gapfloatActionChipGapThe gap after the row.

Returns: The row's height plus gap, or 0 when the row is hidden.

CapsRowLayout

public static bool CapsRowLayout<T>(T caps, T need, float height, Action<Rect> draw) where T : struct, Enum

The GUILayout form of CapsRow. If caps has every flag in need, reserves a full-width row height tall and draws it. Otherwise reserves nothing.

ParameterTypeDescription
capsTThe active backend's capabilities.
needTThe flags the row needs.
heightfloatThe row's height.
drawAction<Rect>Draws the row.

Returns: True when the row was shown.

CapsRowsHeight

public static float CapsRowsHeight<T>(T caps, float rowHeight, float gap, params T[] needs) where T : struct, Enum

Returns the total height of a stack of caps rows, for sizing a popup. Adds rowHeight plus gap for each entry in needs that caps covers.

ParameterTypeDescription
capsTThe active backend's capabilities.
rowHeightfloatOne row's height.
gapfloatThe gap after each row.
needsparams T[]One entry per row.

Returns: The total height.

Chip

public static bool Chip(Rect r, string icon, string words, bool on = false, bool enabled = true, string tooltip = null, bool caret = false)

Draws a chip. It is lighter with a ring on hover, darker when pressed, light blue with a blue ring and ink when on, and outlined when disabled. With no label, the glyph is centred. Rects 28 pt tall or less use the small padding.

ParameterTypeDefaultDescription
rRectThe rect in GUI coordinates of the current view.
iconstringThe icon name, or null.
wordsstringThe label, or null.
onboolfalseWhether the chip is on.
enabledbooltrueWhether the chip is enabled. A disabled chip is outlined and ignores clicks.
tooltipstringnullThe tooltip, or null.
caretboolfalseWhether to draw a dropdown chevron on the right.

Returns: True when clicked.

ChipFill

public static void ChipFill(Rect r, bool active, bool hovered, bool pressed = false)

Draws the chip fill of a button-like control, such as an options-bar choice or a dropdown.

ParameterTypeDefaultDescription
rRectThe rect in GUI coordinates of the current view.
activeboolWhether the control is active.
hoveredboolWhether the pointer is over the control.
pressedboolfalseWhether the control is pressed.

ColourMenuField

public static void ColourMenuField(Rect rect, Color[] colours, string[] names, int current, System.Action<int> choose, bool dimmed = false)

Draws a Suite colour dropdown. The chip shows the current swatch, name and a chevron. Each menu row shows a swatch and name, and the current row is ticked.

ParameterTypeDefaultDescription
rectRectThe rect in GUI coordinates of the current view.
coloursColor[]One colour per row.
namesstring[]One name per row.
currentintThe chosen index.
chooseSystem.Action<int>Runs with the chosen index on the next editor tick.
dimmedboolfalseWhether to dim the chip, for a colour that is set but overridden, such as by a Random toggle.

ColourMenuField

public static void ColourMenuField(Rect rect, Color[] colours, string[] names, int current, System.Action<int> choose, string emptyIcon, string emptyLabel)

Draws a Suite colour dropdown. When current is not a valid index, the chip shows emptyIcon and emptyLabel.

ParameterTypeDescription
rectRectThe rect in GUI coordinates of the current view.
coloursColor[]One colour per row.
namesstring[]One name per row.
currentintThe chosen index.
chooseSystem.Action<int>Runs with the chosen index on the next editor tick.
emptyIconstringThe icon when nothing is chosen.
emptyLabelstringThe label when nothing is chosen.

ColourMenuFieldWidth

public static float ColourMenuFieldWidth(string label)

Returns the preferred width of a ColourMenuField showing label.

ParameterTypeDescription
labelstringThe label.

Returns: The width.

ColourSwatch

public static Color ColourSwatch(Rect r, Color colour, bool hdr = false)

Draws a colour swatch in the Settings page style (RaptorSuiteSettingsPage.Swatch). Clicking it opens Unity's colour picker without alpha, or the HDR picker when hdr is true. The picker reports edits asynchronously, so wrap the call in BeginChangeCheck and EndChangeCheck to detect them.

ParameterTypeDefaultDescription
rRectThe rect in GUI coordinates of the current view.
colourColorThe colour.
hdrboolfalseWhether to allow HDR values.

Returns: The current colour.

Confirm

public static void Confirm(string title, string message, string action, System.Action run)

Shows a small confirmation dialog inside the Suite, with Cancel and action buttons. If no Suite is open, run is called immediately.

ParameterTypeDescription
titlestringThe dialog's title.
messagestringThe message.
actionstringThe confirm button label.
runSystem.ActionRuns when the user confirms.

ContextIconButton

public static bool ContextIconButton(Rect r, string icon, string tooltip = null, bool on = false, bool enabled = true)

Draws a context bar icon button, 40 pt square with corner radius 8 and a 24 pt glyph.

ParameterTypeDefaultDescription
rRectThe rect in GUI coordinates of the current view.
iconstringThe icon name.
tooltipstringnullThe tooltip, or null.
onboolfalseWhether the button is current.
enabledbooltrueWhether the button is enabled. A disabled button draws in Disabled ink and ignores clicks.

Returns: True when clicked.

EmptyState

public static bool EmptyState(Rect r, string words, string actionWords = null, string actionIcon = null, bool actionEnabled = true, string actionTooltip = null)

Draws the placeholder for an empty list. It shows the dashed-box glyph and words, such as "No packs", in grey on a 32 pt row. When actionWords is set, such as "Add pack", a full-width ActionButton is shown below it. Size r with EmptyStateHeight.

ParameterTypeDefaultDescription
rRectThe rect in GUI coordinates of the current view.
wordsstringThe message.
actionWordsstringnullThe action chip's label, or null for no chip.
actionIconstringnullThe action chip's icon.
actionEnabledbooltrueWhether the action chip is enabled. A disabled chip is dimmed.
actionTooltipstringnullThe action chip's tooltip.

Returns: True when the action was clicked.

EmptyStateHeight

public static float EmptyStateHeight(bool withAction)

Returns the height of an EmptyState, including the gap and action chip when withAction is true.

ParameterTypeDescription
withActionboolWhether the empty state has an action chip.

Returns: The height.

EndModuleCategories

public static void EndModuleCategories(ref float y)

Closes the category left open by ModuleCategory. Does nothing when no category is open.

ParameterTypeDescription
yref floatThe list's running y position, moved below the closed category.

Fill

public static void Fill(Rect r, Color colour, float radius = ControlRadius)

Draws an anti-aliased rounded fill on Repaint.

ParameterTypeDefaultDescription
rRectThe rect in GUI coordinates of the current view.
colourColorThe fill colour.
radiusfloatControlRadiusThe corner radius, in points.

FoldAmount

public static float FoldAmount(string key, bool open)

Returns how open a folding category is, from 0 to 1. The amount animates over 0.12 s when open changes, or jumps to its end when Reduce motion is on. The view repaints while it animates. To animate the fold, multiply the list height by this amount and clip the list.

ParameterTypeDescription
keystringThe category's key, as given to PanelSection.
openboolWhether the section is open.

Returns: The open amount.

FoldChevron

public static void FoldChevron(Rect slot, bool open, Color ink)

Draws a fold chevron that points down when open and right when closed. It rotates over 0.12 s when open changes, and tracks its state between passes.

ParameterTypeDescription
slotRectThe glyph's 12 pt rect. Pass the same rect every pass.
openboolWhether the section is open.
inkColorThe glyph's colour.

FormFused

public static int FormFused(Rect row, string label, FusedAction[] items, bool enabled = true)

Draws a form row containing a FusedRow, as used for the Shift, Scale, Justify, Fit, Rotate and Align rows.

ParameterTypeDefaultDescription
rowRectThe whole row's rect, 32 pt tall.
labelstringThe label.
itemsFusedAction[]The buttons. Reuse the same array, as it is read on every event.
enabledbooltrueWhether the row is enabled. A disabled row ignores clicks.

Returns: The clicked button's index, or -1.

FormRow

public static Rect FormRow(Rect row, string label)

Draws a form row's label in a 64 pt column with an 8 pt gap after it, and returns the remaining rect for the control.

ParameterTypeDescription
rowRectThe whole row's rect.
labelstringThe label.

Returns: The control's rect.

FusedRow

public static int FusedRow(Rect r, FusedAction[] items, bool enabled = true)

Draws a fused action row, the standard control for a set of actions. Buttons have equal widths and are joined by 1 pt gaps, with only the row's ends rounded. Each glyph and label is centred. Icon-only rows use 32 pt cells from the left.

ParameterTypeDefaultDescription
rRectThe rect in GUI coordinates of the current view, 32 pt tall.
itemsFusedAction[]The buttons. Reuse the same array, as it is read on every event.
enabledbooltrueWhether the row is enabled. A disabled row ignores clicks.

Returns: The clicked button's index, or -1.

Glyph

public static void Glyph(Rect r, string iconGlyph, Color tint, float size = 16f)

Draws an icon glyph at the given size.

ParameterTypeDefaultDescription
rRectThe rect in GUI coordinates of the current view.
iconGlyphstringThe icon name.
tintColorThe tint colour.
sizefloat16fThe glyph size, in points.

GradientSwatch

public static Gradient GradientSwatch(Rect r, Gradient gradient, bool hdr = false)

Draws a gradient swatch in the ColourSwatch style. Clicking it opens Unity's gradient editor. Wrap the call in BeginChangeCheck and EndChangeCheck to detect edits.

ParameterTypeDefaultDescription
rRectThe rect in GUI coordinates of the current view.
gradientGradientThe gradient.
hdrboolfalseWhether to allow HDR values.

Returns: The current gradient.

GroupLabel

public static void GroupLabel(Rect r, string words)

Draws a 12 pt group label with no chevron or rule. Group labels do not fold.

ParameterTypeDescription
rRectThe rect in GUI coordinates of the current view, 20 pt tall.
wordsstringThe label.

HasCaps

public static bool HasCaps<T>(T caps, T need) where T : struct, Enum

Whether caps has every flag in need. Always true when need is zero.

ParameterTypeDescription
capsTThe active backend's capabilities.
needTThe flags the row needs.

Returns: True when every flag is present.

HeaderIconButton

public static bool HeaderIconButton(Rect r, string icon, string tooltip = null, bool on = false, bool enabled = true)

Draws a panel header icon button (.ph .ib), with a chip fill on hover and no fill otherwise. When on, the ink is blue.

ParameterTypeDefaultDescription
rRectThe rect in GUI coordinates of the current view.
iconstringThe icon name.
tooltipstringnullThe tooltip, or null.
onboolfalseWhether the button is on.
enabledbooltrueWhether the button is enabled. A disabled button draws in Disabled ink and ignores clicks.

Returns: True when clicked.

IconButton

public static bool IconButton(Rect r, string icon, string tooltip = null, bool on = false, bool enabled = true, float glyph = 16f, float radius = ControlRadius)

Draws a bare icon button, with no fill at rest, a pill on hover, and a light blue fill with blue ink when current.

ParameterTypeDefaultDescription
rRectThe rect in GUI coordinates of the current view.
iconstringThe icon name.
tooltipstringnullThe tooltip, or null.
onboolfalseWhether the button is current.
enabledbooltrueWhether the button is enabled. A disabled button draws in Disabled ink and ignores clicks.
glyphfloat16fThe glyph size, in points.
radiusfloatControlRadiusThe pill's corner radius.

Returns: True when clicked.

InputBox

public static void InputBox(Rect r, bool focused)

Draws a recessed input box for a number or text field on Repaint. It has a dark fill and a thin ring that lightens on hover and turns to the accent colour when focused.

ParameterTypeDescription
rRectThe rect in GUI coordinates of the current view.
focusedboolWhether the field has keyboard focus.

Keycaps

public static float Keycaps(float right, float midY, string binding, float alpha = 1f)

Draws keycaps for binding, such as "Ctrl+click" or "Esc", right-aligned to right and centred on midY.

ParameterTypeDefaultDescription
rightfloatThe right edge, in points.
midYfloatThe vertical centre, in points.
bindingstringThe keys, such as Ctrl+click.
alphafloat1fThe opacity, 0 to 1.

Returns: The keycaps' left edge.

KeycapsWidth

public static float KeycapsWidth(string binding)

Returns the width of Keycaps for binding.

ParameterTypeDescription
bindingstringThe keys, such as Ctrl+click.

Returns: The width.

MaterialPreviewTexture

public static Texture MaterialPreviewTexture(Material material)

Returns a material's base texture (_BaseMap, baseColorTexture, _MainTex or _BaseColorMap), or null. It does not use AssetPreview renders. When it returns null, draw the material's flat colour, as MaterialSwatch does.

ParameterTypeDescription
materialMaterialThe material.

Returns: The texture, or null.

MaterialSwatch

public static void MaterialSwatch(Rect r, Material material, float radius, Color tint)

Draws a material swatch on Repaint. It shows the material's texture at its original aspect ratio, or its flat colour if it has no texture, rounded by radius and multiplied by tint.

ParameterTypeDescription
rRectThe rect in GUI coordinates of the current view.
materialMaterialThe material.
radiusfloatThe corner radius, in points.
tintColorThe tint colour.
public static void MenuField(Rect rect, string iconGlyph, string label, System.Func<Menu> build)

Draws a Suite dropdown field that builds and opens a grouped Menu when clicked, like the Workspace field.

ParameterTypeDescription
rectRectThe rect in GUI coordinates of the current view.
iconGlyphstringThe icon name.
labelstringThe label.
buildSystem.Func<Menu>Builds the menu when it opens.
public static void MenuField(Rect rect, string iconGlyph, string label, string[] itemIcons, string[] itemLabels, int current, System.Action<int> choose)

Draws a Suite dropdown field with an icon, label and chevron that opens a Suite menu.

ParameterTypeDescription
rectRectThe rect in GUI coordinates of the current view.
iconGlyphstringThe icon name.
labelstringThe label.
itemIconsstring[]One icon name per row.
itemLabelsstring[]One label per row.
currentintThe chosen index.
chooseSystem.Action<int>Runs with the chosen index on the next editor tick.

ModuleCategory

public static bool ModuleCategory(ref float y, float x, float w, string title, string key, bool defaultOpen = true)

Starts a folding category in a tool panel's list and closes the previous one. The header has 16 pt of space above it, except for the first category.

ParameterTypeDefaultDescription
yref floatThe list's running y position, advanced past the header.
xfloatThe list's left edge.
wfloatThe list's width.
titlestringThe category's name.
keystringThe key that stores the fold state and tracks its animation.
defaultOpenbooltrueWhether it starts open.

Returns: True when the caller should draw the list, including while it folds closed.

Call EndModuleCategories after the last category.

ModuleHead

public static Rect ModuleHead(Rect area, string icon, string title, string meta = null)

Draws a tool panel's head chip at the top of area.

ParameterTypeDefaultDescription
areaRectThe whole panel rect.
iconstringThe icon name.
titlestringThe tool's name.
metastringnullA count shown on the right, or null.

Returns: The panel area below the chip.

ModuleLockedChip

public static void ModuleLockedChip(Rect r, string word, string tooltip = null)

Draws an outlined chip with the lock glyph and word in grey, for a feature whose module or package is not installed. The chip has no hover state and consumes clicks, so they do not reach a control beneath it. Draw it before the control it covers.

ParameterTypeDefaultDescription
rRectThe rect in GUI coordinates of the current view.
wordstringThe label.
tooltipstringnullThe tooltip naming what is missing, such as "Needs HAZE", or null.

ModuleLockedChipWidth

public static float ModuleLockedChipWidth(string word)

Returns the width a ModuleLockedChip needs for word, including padding, glyph and gap.

ParameterTypeDescription
wordstringThe label.

Returns: The width.

NumberField

public static float NumberField(Rect box, string controlName, float value, float step, string axis = null, string unit = null, float min = float.NegativeInfinity, float max = float.PositiveInfinity, string tooltip = null)

Draws a number field with monospaced digits in a recessed box, an optional axis letter before the value, an optional unit after it, and a drag handle on hover.

ParameterTypeDefaultDescription
boxRectThe field's rect, 28 pt tall in forms or 24 pt in Inspector rows.
controlNamestringA control name, unique in the view.
valuefloatThe current value.
stepfloatThe step size.
axisstringnullThe axis letter, such as U, V or X, or null.
unitstringnullThe unit label, or null.
minfloatfloat.NegativeInfinityThe minimum value.
maxfloatfloat.PositiveInfinityThe maximum value.
tooltipstringnullThe tooltip, or null.

Returns: The new value.

NumberField

public static int NumberField(Rect box, string controlName, int value, int step, int min, int max, string axis = null, string tooltip = null)

Draws an integer NumberField.

ParameterTypeDefaultDescription
boxRectThe field's rect, 28 pt tall in forms or 24 pt in Inspector rows.
controlNamestringA control name, unique in the view.
valueintThe current value.
stepintThe step size.
minintThe minimum value.
maxintThe maximum value.
axisstringnullThe axis letter, or null.
tooltipstringnullThe tooltip, or null.

Returns: The new value.

Outline

public static void Outline(Rect r, Color colour, float width, float radius)

Draws a rounded ring width points thick inside r, on Repaint.

ParameterTypeDescription
rRectThe rect in GUI coordinates of the current view.
colourColorThe ring colour.
widthfloatThe ring thickness, in points.
radiusfloatThe corner radius, in points.

PanelRow

public static Rect PanelRow(Rect row, string label, string tooltip = null, float controlHeight = PanelFieldHeight)

Draws a label row's 13 pt label in a 96 pt column with an 8 pt gap after it, and returns the rect for the control.

ParameterTypeDefaultDescription
rowRectThe whole row's rect.
labelstringThe label.
tooltipstringnullThe tooltip, or null.
controlHeightfloatPanelFieldHeightThe control's height, centred on the row.

Returns: The control's rect.

PanelSection

public static bool PanelSection(Rect r, string title, bool open)

Draws a tool panel section title with a fold chevron.

ParameterTypeDescription
rRectThe rect in GUI coordinates of the current view.
titlestringThe section title.
openboolWhether the section is open.

Returns: The new open state.

PanelSection

public static bool PanelSection(Rect r, string title, bool open, string foldKey, string tooltip = null)

Draws the standard folding category header, with a 14 pt medium title at the panel's left edge, a 12 pt chevron on the right and no rule. The title turns white on hover, and the chevron rotates over 0.12 s.

ParameterTypeDefaultDescription
rRectThe rect in GUI coordinates of the current view, 28 pt tall.
titlestringThe section title.
openboolWhether the section is open.
foldKeystringThe key that tracks the fold animation, or null to use the title.
tooltipstringnullThe tooltip, or null.

Returns: The new open state.

PanelTile

public static bool PanelTile(Rect r, string iconGlyph, string words, string keys = null, bool enabled = true, string tooltip = null, bool lit = false, bool labelled = true)

Draws a single-line tool panel tile with a 16 pt glyph at x +10, a 14 pt title at x +36, and keys as keycaps right-aligned 8 pt from the edge. The keycaps are hidden when the title would not fit. The tile has no fill at rest and a pill on hover. A disabled tile uses Disabled ink with no pill, and a lit tile is light blue with a blue ring (see TileLook). Clicks register on release.

ParameterTypeDefaultDescription
rRectThe rect in GUI coordinates of the current view.
iconGlyphstringThe icon name.
wordsstringThe label.
keysstringnullThe hotkey text, or null.
enabledbooltrueWhether the tile is enabled. A disabled tile draws in Disabled ink and ignores clicks.
tooltipstringnullThe tooltip, or null.
litboolfalseWhether the tile is lit.
labelledbooltrueWhether to draw the title and keycaps. Pass false for icon-only panels.

Returns: True when clicked.

PrimaryChip

public static bool PrimaryChip(Rect r, string icon, string words, string meta = null, bool caret = false, string tooltip = null)

Draws the solid primary chip. Use at most one per surface. It is 36 pt tall with corner radius 8, a primary fill and dark ink, with an optional monospaced meta label and chevron on the right.

ParameterTypeDefaultDescription
rRectThe rect in GUI coordinates of the current view.
iconstringThe icon name, or null.
wordsstringThe label.
metastringnullA count shown on the right, or null.
caretboolfalseWhether to draw a dropdown chevron on the right.
tooltipstringnullThe tooltip, or null.

Returns: True when clicked.

Ring

public static void Ring(Rect r, Color colour, float radius = ControlRadius)

Draws an anti-aliased rounded outline on Repaint, as used for billboard rings.

ParameterTypeDefaultDescription
rRectThe rect in GUI coordinates of the current view.
colourColorThe ring colour.
radiusfloatControlRadiusThe corner radius, in points.

RowFill

public static void RowFill(Rect row, bool hovered, bool selected, bool pressed = false)

Draws a row's pill without its content, with a 2 pt margin above and below and corner radius 8. A hovered row gets a pill fill. The current row gets a blue tint that fades out across the row.

ParameterTypeDefaultDescription
rowRectThe whole row's rect.
hoveredboolWhether the pointer is over the row.
selectedboolWhether this is the current row.
pressedboolfalseWhether the row is pressed.

RowPill

public static bool RowPill(Rect r, string icon, string words, string meta = null, bool selected = false, bool enabled = true, string tooltip = null)

Draws a row pill with a glyph, a label and a monospaced count on the right. Rows are 28 pt tall when compact and 36 pt tall for Settings navigation.

ParameterTypeDefaultDescription
rRectThe rect in GUI coordinates of the current view.
iconstringThe icon name, or null.
wordsstringThe label.
metastringnullA count shown on the right, or null.
selectedboolfalseWhether this is the current row.
enabledbooltrueWhether the row is enabled. A disabled row draws in Disabled ink and ignores clicks.
tooltipstringnullThe tooltip, or null.

Returns: True when clicked.

Segment

public static int Segment(Rect r, string[] words, int current, string[] icons = null, bool enabled = true, string[] tooltips = null)

Draws a segmented control, the standard control for choosing one of several options. Cells have equal widths on a Muted track with a 2 pt inset, and the chosen cell is light blue with blue ink. A cell is chosen on mouse release.

ParameterTypeDefaultDescription
rRectThe rect in GUI coordinates of the current view, 32 pt tall.
wordsstring[]One label per cell.
currentintThe chosen index.
iconsstring[]nullOne icon name per cell, or null.
enabledbooltrueWhether the control is enabled. A disabled control draws in Disabled ink and ignores clicks.
tooltipsstring[]nullOne tooltip per cell, or null.

Returns: The chosen index.

SegmentCellWidth

public static float SegmentCellWidth(string word, bool hasIcon)

Returns a cell's preferred width in SegmentHugging, including 8 pt of padding on each side.

ParameterTypeDescription
wordstringThe label.
hasIconboolWhether the cell has a glyph.

Returns: The width, in points.

Segmented

public static int Segmented(Rect r, string[] labels, int index)

Draws a segmented choice in the Settings page style. Options are sized to their labels and right-aligned. The chosen option uses the Selected chip fill, an edge and accent text.

ParameterTypeDescription
rRectThe rect in GUI coordinates of the current view.
labelsstring[]One label per option.
indexintThe chosen index.

Returns: The chosen index.

SegmentHugging

public static int SegmentHugging(Rect r, string[] words, int current, string[] icons = null)

Draws a Segment whose cells fit their labels instead of sharing the width equally (seg() in a group that shrinks to fit). It is placed at the left of r.

ParameterTypeDefaultDescription
rRectThe rect in GUI coordinates of the current view.
wordsstring[]One label per cell.
currentintThe chosen index.
iconsstring[]nullOne icon name per cell, or null.

Returns: The chosen index.

SegmentNaturalWidth

public static float SegmentNaturalWidth(string[] labels)

Returns the width a segmented track needs for labels.

ParameterTypeDescription
labelsstring[]One label per option.

Returns: The width.

ShowMenu

public static void ShowMenu(Menu menu, Rect? activator = null)

Opens a grouped Menu under activator, or at the pointer when activator is null. Use it for right-click menus on tiles and chips, such as a module's presets.

ParameterTypeDefaultDescription
menuMenuThe menu.
activatorRect?nullThe rect the menu opens under, or null to open at the pointer.

ShowMenuStayOpen

public static void ShowMenuStayOpen(Rect activator, System.Func<Menu> build, float minWidth = 0f)

Opens a menu that stays open while its rows are clicked. build creates the rows when the menu opens and after each click. The menu closes on Esc or a click outside.

ParameterTypeDefaultDescription
activatorRectThe rect of the control the menu opens from.
buildSystem.Func<Menu>Builds the menu rows.
minWidthfloat0fThe minimum menu width.

Slider

public static float Slider(Rect r, float value, float min, float max, float notch = float.NaN)

Draws a Suite slider with an accent fill and a white knob that turns to the accent colour while held. Clicking or dragging sets the value between min and max, rounded to 0.01. notch adds a soft detent, shown as a tick. The value snaps to it within 7 pt and can be dragged past it. Sets GUI.changed when the value is edited.

ParameterTypeDefaultDescription
rRectThe rect in GUI coordinates of the current view.
valuefloatThe current value.
minfloatThe minimum value.
maxfloatThe maximum value.
notchfloatfloat.NaNA detent value, or NaN for none.

Returns: The new value.

Snap

public static Rect Snap(Rect r)

Snaps a rect to whole device pixels.

ParameterTypeDescription
rRectThe rect in GUI coordinates of the current view.

Returns: The snapped rect.

StepFloat

public static float StepFloat(Rect box, string controlName, float value, float step, float min, float max, string unit = null, string tooltip = null)

Draws a draggable float field with an up/down handle that steps by step between min and max. An optional unit is shown inside the box.

ParameterTypeDefaultDescription
boxRectThe field's rect.
controlNamestringA control name, unique in the view.
valuefloatThe current value.
stepfloatThe step size.
minfloatThe minimum value.
maxfloatThe maximum value.
unitstringnullThe unit label shown inside the box, or null.
tooltipstringnullThe tooltip, or null.

Returns: The new value.

StepInt

public static int StepInt(Rect box, string controlName, int value, int step, int min, int max, string tooltip = null)

Draws a draggable integer field with an up/down handle that steps by step between min and max.

ParameterTypeDefaultDescription
boxRectThe field's rect.
controlNamestringA control name, unique in the view.
valueintThe current value.
stepintThe step size.
minintThe minimum value.
maxintThe maximum value.
tooltipstringnullThe tooltip, or null.

Returns: The new value.

Switch

public static bool Switch(Rect area, bool on, float width = 46, float height = 26)

Draws a Settings switch. The knob position and track colour show the state.

ParameterTypeDefaultDescription
areaRectThe area. The switch is placed at its right edge.
onboolThe current state.
widthfloat46The switch's width.
heightfloat26The switch's height.

Returns: The new state.

TagWidth

public static float TagWidth(string text)

Returns a text tag's width, which is the text plus 8 pt of padding on each side.

ParameterTypeDescription
textstringThe text.

Returns: The width.

TextField

public static string TextField(Rect r, string value, string placeholder, string controlName = null)

Draws a Settings page text box.

ParameterTypeDefaultDescription
rRectThe rect in GUI coordinates of the current view.
valuestringThe current value.
placeholderstringThe text shown while the field is empty.
controlNamestringnullA control name for keyboard focus, unique in the view.

Returns: The new text.

TextPrompt

public static void TextPrompt(Rect activator, string title, string initial, string okWords, Func<string, string> validate, Action<string> commit)

Opens a small Suite text prompt under activator, with a title, one field, and OK and Cancel buttons. Enter confirms and Esc cancels. validate returns null for valid text, or a reason that is shown under the field while OK stays disabled. commit receives the trimmed text on the next editor tick.

ParameterTypeDescription
activatorRectThe rect the prompt opens under, in GUI coordinates of the current view.
titlestringThe dialog's title.
initialstringThe starting text.
okWordsstringThe OK button label.
validateFunc<string, string>Returns why the text is invalid, or null when it is valid.
commitAction<string>Runs with the accepted text.

TextPromptAtPointer

public static void TextPromptAtPointer(string title, string initial, string okWords, Func<string, string> validate, Action<string> commit)

Opens a TextPrompt at the pointer. Use it from a menu item's action, after the menu row has closed.

ParameterTypeDescription
titlestringThe dialog's title.
initialstringThe starting text.
okWordsstringThe OK button label.
validateFunc<string, string>Returns why the text is invalid, or null when it is valid.
commitAction<string>Runs with the accepted text.

Tick

public static bool Tick(Rect r, string words, bool on, bool enabled = true, string tooltip = null)

Draws a tick box, the standard control for an on/off option. The 16 pt box has corner radius 4, is outlined when off and solid primary with a tick when on, and is followed by a 13 pt label.

ParameterTypeDefaultDescription
rRectThe rect in GUI coordinates of the current view, TickWidth wide and 28 pt tall.
wordsstringThe label.
onboolThe current state.
enabledbooltrueWhether the tick box is enabled. A disabled tick box draws in Disabled ink and ignores clicks.
tooltipstringnullThe tooltip, or null.

Returns: The new state.

TickWidth

public static float TickWidth(string words)

Returns the width a Tick needs.

ParameterTypeDescription
wordsstringThe label.

Returns: The width.

Tile

public static bool Tile(Rect r, string icon, string words, string keys = null, bool enabled = true, string tooltip = null, bool lit = false)

Draws a tile, the same as PanelTile.

ParameterTypeDefaultDescription
rRectThe rect in GUI coordinates of the current view.
iconstringThe icon name.
wordsstringThe label.
keysstringnullThe hotkey text, or null.
enabledbooltrueWhether the tile is enabled. A disabled tile draws in Disabled ink and ignores clicks.
tooltipstringnullThe tooltip, or null.
litboolfalseWhether the tile is lit.

Returns: True when clicked.

TileLook

public static (Color fill, Color ink, float title) TileLook(bool built, bool usable, bool mouseOver, bool lit, bool pressed)

Returns the fill, glyph ink and title opacity of a Mesh tool panel tile for its state. Only usable tiles highlight on hover. Tiles that are not built yet are darker.

ParameterTypeDescription
builtboolWhether the tool is built.
usableboolWhether the tool can be used now.
mouseOverboolWhether the pointer is over the tile.
litboolWhether the tile is lit.
pressedboolWhether the tile is pressed.

Returns: The fill, ink and title opacity.

TileLookEased

public static (Color fill, Color ink, float title, float ring, bool moving) TileLookEased(Rect r, bool built, bool usable, bool mouseOver, bool lit, bool pressed)

Returns an animated TileLook for a tile you draw yourself, with the fill and ink blended between states and the strength of the lit ring. It matches TileLook when nothing is animating.

ParameterTypeDescription
rRectThe tile's rect.
builtboolWhether the tool is built.
usableboolWhether the tool can be used now.
mouseOverboolWhether the pointer is over the tile.
litboolWhether the tile is lit.
pressedboolWhether the tile is pressed.

Returns: The fill, ink, title opacity, ring strength, and whether the tile is animating.

Tip

public static string Tip(string tooltip)

Wraps a control's tooltip so it is hidden while a Suite menu is open.

ParameterTypeDescription
tooltipstringThe tooltip, or null.

Returns: The tooltip, or null while a menu is open.