Table of Contents

Method UseFrame

Namespace
Velvet
Assembly
Velvet.Docs.dll

UseFrame(Action<float>, int)

Per-frame callback: onFrame runs once per frame with the elapsed time in seconds while the component stays mounted, and stops on unmount. The latest render's closure is always the one invoked — a re-render swaps the callback without re-subscribing — so per-frame data flows without touching component state (the escape hatch for simulation-driven visuals; setting state per frame would re-render the world every tick). Frames tick while the component's host is attached to a panel and pause while it is not. priority orders callbacks within the SAME panel — lower runs earlier, equal priorities run in subscription (mount) order, and this stays true across a keyed reorder of the host. A positive priority has no side effect beyond ordering: Unity's rendering is independent of this scheduler, so there is no internal render call for it to take over. The latest render's priority applies live, the same way onFrame does — changing it does not restart the subscription or move it among same-priority siblings.

public static void UseFrame(Action<float> onFrame, int priority = 0)

Parameters

onFrame Action<float>

Invoked once per frame with the elapsed time in seconds (always positive).

priority int

Lower runs earlier within the same panel this frame. Defaults to 0.