Skip to main content
Version: 2.0.x (Unreleased)

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

Jungle Playback Lifecycle Diagram


Node Lifecycle

JunglePlayback is responsible for handling each node's lifecycle.

  1. 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.
  2. 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

  1. On Start (OnStart()):
    • Runs once.
    • If you call Stop() or CallAndStop() here ➡️ jump straight to OnStop().
  2. Update Cycle:
    • OnUpdate(), OnLateUpdate(), OnFixedUpdate() (fired in any order).
    • Repeat until you call Stop() or CallAndStop().
  3. On Stop (OnStop()):
    • Runs once when the node stops.

Jungle Playback Lifecycle Diagram