Runtime Availability
Prepare scene resources that your game will create or use later.
On this page
Pixscape discovers resources used by content already placed in a scene. Add any extra resource that gameplay will create or select later to that scene’s Runtime Availability.
If gameplay will create or use a resource that is not otherwise part of the scene’s discovered resources, add it to Runtime Availability before loading the scene.
Typical examples include:
- a Game Object spawned later by gameplay code
- a particle effect used after an impact
- an animation created dynamically
- a sprite that is never placed directly in the scene
- an asset that an existing entity can switch to during gameplay
Runtime Availability is scene-relative. A resource can be prepared for one scene without being included in every other scene.
Runtime Availability and READY
During scene loading, Pixscape prepares the scene and its declared Runtime Availability resources. When loading reaches READY, those resources are ready to use.
Gameplay APIs do not silently load an undeclared resource after READY. If an operation needs a resource that was not prepared, it fails. This applies to both blocking and progressive scene loading.
Gameplay code continues to use logical names or IDs:
if (api.assets().contains("coin")) {
api.sprites().spawn("coin", 120f, 64f);
}
Game Objects
A Game Object that gameplay will spawn later must be declared through Runtime Availability when it is not otherwise part of the scene’s discovered resources. Add the Game Object itself; its declared visual resources are prepared with it.
EntityRef boss =
api.gameObjects().requireRoot("Boss", arenaX, arenaY);
boss.animation().play("idle").setLoop(true);
gameState.setBoss(boss);
Use GameObjectInstance instead when gameplay needs to manage the complete hierarchy lifecycle. See Game Objects API.
Particles
Particle effects created through api.particles() must already be prepared for the scene. Calling spawn(...), oneshot(...), or setEffect(...) during gameplay does not load an undeclared effect.
If a resource is missing
Different APIs report unavailable resources with the exception appropriate to the operation. Place the resource in the scene or add it to Runtime Availability, export again, and reload the scene.