Choosing a UI API
KILLSCRIPT provides three main ways to present custom information. Each serves a different job.
| Tool | Best for | Model |
|---|---|---|
ImGui |
Quick HUD, text, images, debugging | Redrawn every frame |
UI + UXML/USS |
Panels, menus, lists, buttons | Persistent element tree |
WorldVisuals |
Lines and areas inside the world | Objects in world coordinates |
Choose ImGui when
Section titled “Choose ImGui when”- you need a few lines or an image;
- content changes often;
- mouse interaction is unnecessary;
- you are prototyping quickly.
Scheduler:OnFrame(function() ImGui:DrawDebugText("Ping: " .. tostring(NetworkInfo.Ping))end)Choose UXML when
Section titled “Choose UXML when”- the interface contains containers, lists, or forms;
- you need buttons, text fields, or scrolling;
- styling belongs in USS;
- elements should persist between frames.
local root = UI:BuildFromUxmlAbsolute("Panel.uxml")UXML is built once. Lua then changes existing element properties.
Choose WorldVisuals when
Section titled “Choose WorldVisuals when”- a line connects world positions;
- an area lies on a map surface;
- the visual belongs to an object position rather than the screen.
local line = WorldVisuals:CreateLineRenderer()line:SetPositionCount(2)line:SetPosition(0, Vector3.zero)line:SetPosition(1, Vector3.up)Combine them when useful
Section titled “Combine them when useful”One module can use UXML for settings, ImGui for a lightweight HUD, and WorldVisuals for map objects. Avoid presenting the same information in several layers and remove temporary objects explicitly.
Continue with an ImGui HUD, your first UXML interface, and the WorldVisuals reference. Types used in the examples are documented under Scheduler, NetworkInfo, and Vector3.