ScreenPanel— root container that renders childPanelComponentobjects as a screen-space HUD.WorldPanel— root container that renders childPanelComponentobjects into 3D world space.PanelComponent— abstract base class for your own Razor UI components. Must be a descendant of aScreenPanelorWorldPanel.
ScreenPanel
ScreenPanel renders any attached PanelComponent children to the screen. It acts as the root of your HUD hierarchy. The CameraComponent automatically composites all active ScreenPanel objects on top of the scene in ZIndex order.
Rendering order relative to other
ScreenPanel instances. Higher values render on top.Manual scale override for all child panels. Only takes effect when
AutoScreenScale is false. Range 0–5.When
true, the panel scales automatically according to the ScaleStrategy. Overrides Scale.Automatic scaling mode.
ConsistentHeight scales so that the panel always matches a 1080p baseline. FollowDesktopScaling uses the OS desktop scale. Only visible when AutoScreenScale is true.Overall opacity of the entire panel hierarchy. Range 0–1.
If set, this
ScreenPanel is only rendered by the specified camera. Leave null to render on the main camera.WorldPanel
WorldPanel renders child PanelComponent objects as a flat panel placed in 3D world space, like a name tag or in-world screen. It inherits from Renderer so it participates in the standard render pipeline.
The width and height of the panel surface in UI units.
A scale multiplier applied to the panel’s world-space size without changing its UI-space resolution.
When
true, the panel automatically rotates to face the main camera each frame — useful for billboard-style name tags.Horizontal alignment of the panel surface relative to the GameObject’s origin. Options:
Left, Center, Right.Vertical alignment of the panel surface relative to the GameObject’s origin. Options:
Top, Center, Bottom.Maximum distance at which a player can interact with this world panel using mouse input.
PanelComponent
PanelComponent is the abstract base class for all UI leaf components. You subclass it (usually paired with a .razor file) to define the panel’s markup and update logic.
Key members
The underlying
Panel object. Can be null if the component is disabled or has not yet been enabled.Methods
| Method | Description |
|---|---|
BuildHash() | Override to return a hash of the data that drives this panel. The framework calls this each frame; when the hash changes, the panel re-renders. Return 0 to always re-render. |
StateHasChanged() | Explicitly request a re-render on the next frame. Call this when you mutate state outside of BuildHash. |
AddClass(string) | Adds a CSS class to the underlying panel. |
RemoveClass(string) | Removes a CSS class from the underlying panel. |
SetClass(string, bool) | Adds or removes a CSS class based on a boolean. |
HasClass(string) | Returns true if the panel currently has the given class. |
BindClass(string, Func<bool>) | Binds a CSS class to a function evaluated each frame. |
Lifecycle callbacks
| Method | Description |
|---|---|
OnTreeFirstBuilt() | Called once after the Razor tree is built for the first time. |
OnTreeBuilt() | Called every time the Razor tree is rebuilt. |
Example: HUD health bar
The example below shows a minimalScreenPanel hierarchy with a custom PanelComponent that displays a health value.
Scene hierarchy: