SceneTickListener class abstract Scene graph

Runs code at fixed points of a Scene's tick, before any component does.

Components tick root-first in tree order, so a component cannot guarantee it runs before every other one. A listener can, which is what per-frame sampling needs (an input system snapshotting devices, a network client applying received state).

class FrameCounter extends SceneTickListener {
  int frames = 0;
  int steps = 0;

  @override
  void beforeTick(double deltaSeconds) => frames++;

  @override
  void beforeFixedStep(double fixedDt) => steps++;
}

scene.addTickListener(FrameCounter());

Both callbacks default to doing nothing, so a listener overrides only what it needs.

Constructors

SceneTickListener()
Constant constructor for subclasses.
const

Properties

hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

beforeFixedStep(double fixedDt) → void
Called before each fixed step, ahead of every component's fixedUpdate for that step. Runs zero or more times per tick, and never when the scene has no PhysicsWorld.
beforeTick(double deltaSeconds) → void
Called once at the start of each scene tick, before its fixed steps and before any component's update.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited