Lifecycles
Understanding the lifecycles of the different runtime systems is key to implementing Jungle Sequencer effectively.
This page has explanations and visual diagrams that break down the lifecycles of both JunglePlayback
and JungleNode
.
These will help you get a clear picture of how each component behaves over time and how they interact with each other.
Playback Lifecycle
The JunglePlayback
is an object created by the runtime used to handle playback of a JungleTree
.
When a tree is played, the runtime automatically creates a playback for the tree.
The created playback is then initialized and registered with the runtime and begins execution.
Diagram
Node Lifecycle
JunglePlayback
is responsible for handling each node's lifecycle.
- When the runtime starts playback for a tree, it spins up a
JunglePlayback
and clones every node in the tree. These clones are known as playback node instances. - The playback runs and updates only the playback node instances. Each play gets a fresh copy of the node, so nothing that happens in one playback leaks into the next.
Changes made to a playback instance's serialized data are never saved.
Diagram
- On Start (
OnStart()
):- Runs once.
- If you call
Stop()
orCallAndStop()
here ➡️ jump straight toOnStop()
.
- Update Cycle:
OnUpdate()
,OnLateUpdate()
,OnFixedUpdate()
(fired in any order).- Repeat until you call
Stop()
orCallAndStop()
.
- On Stop (
OnStop()
):- Runs once when the node stops.