graphics.on_draw

Register a per-tick overlay drawing callback.

Syntax

ue.graphics.on_draw(callback: function) -> integer

Parameters

ParameterTypeDescription
callbackfunctionFunction that emits drawing commands.

Returns

TypeDescription
integerDrawing callback ID for graphics.off_draw.

Example

local draw_id = ue.graphics.on_draw(function()
    ue.graphics.text(20, 20, "Lua overlay")
end)

Notes

  • Use graphics primitives inside this callback. Commands emitted elsewhere are not retained for the next frame.
  • The callback runs on the Unreal game thread once per engine tick.
  • The normal 2 ms / 50,000-instruction callback budget applies.
  • A callback that raises an error is logged and automatically removed.

On this page