OnFrame
Every frame - where a script draws.
The game’s drawing functions (System.DrawLabel, System.DrawLine …) show what they draw for one frame only, so a
mark that should stay is drawn again every frame from here; a timer would blink. The argument is the frame’s length in
seconds. An error inside is logged ([KcdMp] OnFrame: ... (disabled)) and the callback is switched off, so a broken
script cannot fill the log sixty times a second. Keep the work small: it runs on the game’s thread, every frame. The
elements of CreateUiText and its family need no redrawing - they stay until removed.
Syntax
Section titled “Syntax”function OnFrame(dt) -- ...end| Parameter | Type | |
|---|---|---|
dt |
number | the frame time in seconds |
Returns
Section titled “Returns”nothing
Example
Section titled “Example”function OnFrame(dt) if marker then System.DrawLabel({x = marker.x, y = marker.y, z = marker.z + 1.6}, 1.4, "here", 1, 0.85, 0.3, 1) endendSee also
Section titled “See also”OnServerEvent · WorldToScreen · the The player, the level and the frame group of the index
