S&box Wiki

UI with Components

Creating and displaying UI with components

When doing UI with components you must do two things:

  1. Attach a ScreenPanel component onto a game object in the scene.
  2. Attach your UI component to the same game object.

Then your UI will display on the screen.

Creating a UI Component

Derive a component from the PanelComponent component.

MyPanel.razor

@using Sandbox.UI @inherits PanelComponent <root> <p>Hello world 123</p> </root>