Per-frame lifecycle: Update, FixedUpdate, Start, OnDestroy and Time (#75) #81
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
crowmaki/cinnabar#81
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Parent
#75
What to build
A Script Component's
Update(dt),FixedUpdate(dt),Start()andOnDestroy()methods run from the Plugin's Hooks and the Schema's Component Hooks, the Unity way. The Plugin'supdateandfixed_updateHooks walk each Script class in Schema registration order and, within a class, walkcomponent_storageby index, re-fetching storage every iteration because a call into a Script may add Components and move it.Startruns immediately before the firstUpdateof an instance whose Transient started bit is clear, then sets the bit; the bit is a Transient Field the host declares in the description, not a Core concept. Instances on a GameObject that is not Active in Hierarchy are skipped byUpdate,FixedUpdateand thereforeStart.OnDestroyruns fromon_remove, exactly once whichever way the Component leaves.A
Timetable withdeltaTime,fixedDeltaTimeandframeCountis refreshed at the top of each Hook from Frame Timing. A runtime error in one instance'sUpdateis logged with a Luau traceback and the rest of the frame continues.Acceptance criteria
Updateruns once per frame per live instance, andFixedUpdateonce per fixed step, with counts checked across a multi-step Tick usingengine_tick_with_deltaStartruns exactly once per instance, on the first frame it is updated, after every Component on the same GameObject added that frame has runAwakeStart,UpdateorFixedUpdateuntil the subtree is active againOnDestroyruns exactly once for direct Component removal, for owner GameObject destruction, and for Scene unloadTime.deltaTime,Time.fixedDeltaTimeandTime.frameCountmatch the Frame Timing the Hook receivedUpdateis logged with a traceback and every other instance in that frame still updatesBlocked by