Razorbill
Components

UI Components

Razorbill includes a full runtime UI system. All UI elements must be children of a UICanvasComponent entity.

UICanvasComponent

Root of a UI hierarchy. All UI elements must be descendants of a canvas.

PropertyTypeDefaultDescription
render_modeEnumscreen_spacescreen_space (HUD/menus), world_space (3D positioned), render_to_texture
sort_orderInt0Render order for multiple canvases (higher = on top)
world_scaleFloat0.01Scale factor for world-space canvases

Creating a Canvas

{
  "op": "CreateUICanvas",
  "params": {
    "canvas_name": "HUD",
    "render_mode": "screen_space",
    "sort_order": 0
  }
}

UIRectTransformComponent

2D positioning system for UI elements using anchors, pivots, and offsets.

PropertyTypeDefaultDescription
anchor_minVec2{x:0.5, y:0.5}Bottom-left anchor point (0-1 normalized)
anchor_maxVec2{x:0.5, y:0.5}Top-right anchor point (0-1 normalized)
pivotVec2{x:0.5, y:0.5}Pivot point for positioning and rotation
anchored_positionVec2{x:0, y:0}Offset from anchor position in pixels
size_deltaVec2{x:100, y:100}Element size in pixels

Common Anchor Presets

Layoutanchor_minanchor_max
Center{x:0.5, y:0.5}{x:0.5, y:0.5}
Top-left{x:0, y:1}{x:0, y:1}
Bottom-right{x:1, y:0}{x:1, y:0}
Stretch horizontal{x:0, y:0.5}{x:1, y:0.5}
Full stretch{x:0, y:0}{x:1, y:1}

UITextComponent

Renders text with configurable font, size, color, and alignment.

PropertyTypeDefaultDescription
textString""Text content to display
font_guidGuid?nullFont asset GUID (uses default if null)
font_sizeFloat16Font size in pixels
colorVec4{x:1, y:1, z:1, w:1}Text color (RGBA)
horizontal_alignmentEnumleftleft, center, right
vertical_alignmentEnumtoptop, middle, bottom
word_wrapBooltrueWrap text to element width

Scripting: Dynamic Text

void OnUpdate(ScriptContext* ctx) {
    EntityHandle label = ctx->find_entity_by_name(ctx, "ScoreLabel");
    char buf[64];
    snprintf(buf, sizeof(buf), "Score: %d", score);
    ctx->set_ui_text(ctx, label, buf);
}

UIButtonComponent

A clickable button with visual state transitions.

PropertyTypeDefaultDescription
normal_colorVec4{x:0.8, y:0.8, z:0.8, w:1}Default button color
hover_colorVec4{x:0.9, y:0.9, z:0.9, w:1}Color when mouse is over
pressed_colorVec4{x:0.7, y:0.7, z:0.7, w:1}Color when pressed
disabled_colorVec4{x:0.5, y:0.5, z:0.5, w:0.5}Color when disabled
current_stateEnumnormal, hovered, pressed, disabled
on_click_scriptGuid?nullScript to invoke on click
interactableBooltrueWhether the button accepts input

Scripting: Button Click Detection

void OnUpdate(ScriptContext* ctx) {
    EntityHandle btn = ctx->find_entity_by_name(ctx, "StartButton");
    if (ctx->was_ui_button_clicked(ctx, btn)) {
        // Start the game
    }
}

UIImageComponent

Displays an image or solid color.

PropertyTypeDefaultDescription
texture_guidGuid?nullTexture asset GUID
colorVec4{x:1, y:1, z:1, w:1}Tint color (multiplied with texture)
image_typeEnumsimplesimple, sliced, tiled, filled
border_left/right/top/bottomFloat09-slice border sizes (for sliced type)
preserve_aspectBoolfalseMaintain texture aspect ratio

UIPanelComponent

A background panel with optional border and rounded corners.

PropertyTypeDefaultDescription
background_colorVec4{x:0.2, y:0.2, z:0.2, w:1}Panel background color
background_texture_guidGuid?nullOptional background texture
show_borderBoolfalseShow border outline
border_colorVec4{x:0.4, y:0.4, z:0.4, w:1}Border color
border_widthFloat1Border width in pixels
corner_radiusFloat0Rounded corner radius

UISliderComponent

A draggable slider for numeric input.

PropertyTypeDefaultDescription
valueFloat0.5Current slider value
min_valueFloat0Minimum value
max_valueFloat1Maximum value
stepFloat0Step increment (0 = continuous)
handle_sizeFloat16Handle diameter in pixels
handle_colorVec4{x:0.9, y:0.9, z:0.9, w:1}Handle color
handle_hover_colorVec4{x:1, y:1, z:1, w:1}Handle color when hovered
track_heightFloat4Track height in pixels
track_fill_colorVec4{x:0.3, y:0.7, z:0.3, w:1}Filled portion color
track_background_colorVec4{x:0.2, y:0.2, z:0.2, w:1}Unfilled portion color
verticalBoolfalseVertical orientation
on_value_changed_scriptGuid?nullScript invoked when value changes
interactableBooltrueWhether the slider accepts input

UIToggleComponent

A checkbox or switch toggle.

PropertyTypeDefaultDescription
is_onBoolfalseCurrent toggle state
modeEnumcheckboxVisual mode: checkbox or switch
on_colorVec4{x:0.3, y:0.7, z:0.3, w:1}Color when toggled on
off_colorVec4{x:0.5, y:0.5, z:0.5, w:1}Color when toggled off
on_checkmark_colorVec4{x:1, y:1, z:1, w:1}Checkmark/thumb color when on
off_checkmark_colorVec4{x:0, y:0, z:0, w:0}Checkmark/thumb color when off
switch_track_widthFloat40Track width in switch mode
switch_track_heightFloat20Track height in switch mode
switch_thumb_sizeFloat16Thumb diameter in switch mode
on_toggle_scriptGuid?nullScript invoked when toggled
interactableBooltrueWhether the toggle accepts input

UIProgressBarComponent

A fill-based progress indicator.

PropertyTypeDefaultDescription
fill_amountFloat0.5Fill progress (0.0 to 1.0)
fill_colorVec4{x:0.3, y:0.7, z:0.3, w:1}Filled portion color
background_colorVec4{x:0.2, y:0.2, z:0.2, w:1}Background color
directionEnumleft_to_rightFill direction: left_to_right, right_to_left, bottom_to_top, top_to_bottom
labelString?nullOptional text label
show_labelBoolfalseShow label text

Scripting: Updating Progress

void OnUpdate(ScriptContext* ctx) {
    EntityHandle bar = ctx->find_entity_by_name(ctx, "HealthBar");
    float health = current_hp / max_hp;
    ctx->set_ui_fill_amount(ctx, bar, health);
}

UIInputFieldComponent

Text input field with cursor, selection, and content validation.

PropertyTypeDefaultDescription
textString""Current text content
placeholderString""Placeholder text when empty
content_typeEnumstandardValidation: standard, integer, decimal, password, email
character_limitInt0Max characters (0 = unlimited)
font_sizeFloat16Font size
text_colorVec4{x:1, y:1, z:1, w:1}Text color
placeholder_colorVec4{x:0.5, y:0.5, z:0.5, w:1}Placeholder text color
background_colorVec4{x:0.15, y:0.15, z:0.15, w:1}Background color
selection_colorVec4{x:0.3, y:0.5, z:0.8, w:0.5}Text selection highlight
caret_colorVec4{x:1, y:1, z:1, w:1}Cursor caret color
caret_blink_rateFloat1.0Caret blink speed
interactableBooltrueWhether the field accepts input
read_onlyBoolfalseDisplay-only mode
on_value_changed_scriptGuid?nullScript invoked when text changes
on_submit_scriptGuid?nullScript invoked on Enter/Return

UIDropdownComponent

A dropdown selector with scrollable options list.

PropertyTypeDefaultDescription
selected_indexInt-1Currently selected option index (-1 = none)
optionsArray<String>[]List of option labels
max_visible_optionsInt5Max visible options before scrolling
placeholderString"Select..."Placeholder text when nothing selected
font_sizeFloat16Font size
background_colorVec4{x:0.2, y:0.2, z:0.2, w:1}Button background
hover_colorVec4{x:0.3, y:0.3, z:0.3, w:1}Option hover color
selected_colorVec4{x:0.3, y:0.5, z:0.8, w:1}Selected option color
text_colorVec4{x:1, y:1, z:1, w:1}Text color
interactableBooltrueWhether the dropdown accepts input
on_selection_changed_scriptGuid?nullScript invoked when selection changes

UILayoutGroupComponent

Flexbox-style layout that arranges child elements.

PropertyTypeDefaultDescription
directionEnumverticalLayout direction: horizontal or vertical
justify_contentEnumstartMain axis: start, center, end, space_between, space_around
align_itemsEnumstartCross axis: start, center, end, stretch
wrapBoolfalseWrap children to next line
spacingFloat0Gap between children in pixels
padding_left/right/top/bottomFloat0Internal padding
control_child_sizeBooltrueOverride child sizes
expand_to_fillBoolfalseExpand children to fill available space

UILayoutElementComponent

Per-element layout overrides for children of a layout group.

PropertyTypeDefaultDescription
padding_left/right/top/bottomFloat0Element padding
margin_left/right/top/bottomFloat0Element margin
min_width/heightFloat-1Minimum size (-1 = auto)
preferred_width/heightFloat-1Preferred size (-1 = auto)
max_width/heightFloat-1Maximum size (-1 = auto)
flex_growFloat0How much this element grows to fill space
flex_shrinkFloat1How much this element shrinks when space is limited
flex_basisFloat-1Initial size before flex (-1 = auto)
ignore_layoutBoolfalseExclude from layout calculations

On this page