onLoad method

  1. @override
Future<void> onLoad()
override

Optional asynchronous setup, such as loading an asset.

Runs once, the first time the owning node enters a live scene. update is deferred until the returned future completes.

Implementation

@override
Future<void> onLoad() async {
  final engine = this.engine;
  if (_clip == null && asset != null && engine != null) {
    _clip = await engine.loadClip(asset!);
    _ownsClip = true;
  }
  if ((autoplay || _pendingPlay) && isMounted) play();
}