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

FunctionDescription
graphics.on_drawRegister a per-tick drawing callback.
graphics.off_drawRemove a drawing callback.
graphics.colorCreate a packed RGBA color.
graphics.lineDraw a screen-space line.
graphics.rectDraw a rectangle outline.
graphics.rect_filledDraw a filled rectangle.
graphics.circleDraw a circle outline.
graphics.circle_filledDraw a filled circle.
graphics.textDraw UTF-8 text.
graphics.screen_sizeReturn the overlay dimensions.
graphics.world_to_screenProject 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.

On this page