Graphics
Draw game overlays, debug visuals, and object ESPs from Lua.
ue.graphics provides lightweight immediate-mode drawing on the UnlockedEditor overlay for object ESPs, labels, hitbox/debug displays, guides, and other script-owned visuals.
Graphics require both the Lua and GUI modules and must be used from a persistent Lua session. Drawing callbacks run on the Unreal game thread; their bounded command buffers are copied to the DX11 or DX12 renderer.
Available Functions
| Function | Description |
|---|---|
graphics.on_draw | Register a per-tick drawing callback. |
graphics.off_draw | Remove a drawing callback. |
graphics.color | Create a packed RGBA color. |
graphics.line | Draw a screen-space line. |
graphics.rect | Draw a rectangle outline. |
graphics.rect_filled | Draw a filled rectangle. |
graphics.circle | Draw a circle outline. |
graphics.circle_filled | Draw a filled circle. |
graphics.text | Draw UTF-8 text. |
graphics.screen_size | Return the overlay dimensions. |
graphics.world_to_screen | Project a world position into screen pixels. |
Object ESP example
local g = ue.graphics
local green = g.color(80, 255, 120, 255)
local shadow = g.color(0, 0, 0, 180)
g.on_draw(function()
for _, actor in ipairs(ue.find_all("Character", 128)) do
if actor:is_valid() then
local location = actor:K2_GetActorLocation()
location.Z = location.Z + 100
local screen, visible = g.world_to_screen(location)
if visible then
local width, height = 90, 150
local x = screen.x - width / 2
local y = screen.y - height
g.rect(x + 1, y + 1, width, height, shadow, 3)
g.rect(x, y, width, height, green, 1.5)
g.text(x, y - 20, actor:name(), green, 16)
end
end
end
end)
return {}The class name and world-space offset are game-specific. For accurate boxes, project multiple bounds or socket positions instead of using a fixed screen-space size.
UObject proxies are weak references. Check :is_valid() before reusing one after actor destruction or map travel.
Shared behavior
Coordinates and sizes are screen pixels. Primitives draw on the background layer by default. Pass { layer = "foreground" } as the final options argument to draw over editor windows.
Each session may emit up to 4,096 commands per frame, and each text command may contain up to 2,048 UTF-8 bytes. A failing drawing callback is logged and automatically removed.