Scripting API
Scripting API
SceneAccess
Struct in Abyss.Core, from Abyss.Core.
The world's scenes, to load and unload while a system runs: SystemContext.Scenes.
public readonly struct SceneAccessRemarks
Asked now, done between frames. A scene is loaded and unloaded a slice at a time, by the world's SceneLoader, on the thread that runs the frame — so asking is safe from systems running in parallel, and a scene asked for is told back at once, before any of it is read:
SceneId level = context.Scenes.Load(Addresses.Scenes.Level); // the others go when it is shownSceneId moons = context.Scenes.Load(Addresses.Scenes.Moons, SceneMode.Additive);SceneId city = context.Scenes.Load(Addresses.Scenes.City, pace: ScenePace.Gradual); // shown over framesif (context.Scenes.StateOf(moons) == SceneState.Active) { ... }context.Scenes.Unload(moons);context.Scenes.Unload(city, ScenePace.Gradual); // despawned over frames, never hiddenA scene held (hold: true) waits, built, until SceneAccess.Activate, for a game that shows a loading screen until the player presses on.
Methods
Load
public SceneId Load(SceneAddress scene, SceneMode mode = Single, bool hold = false, ScenePace pace = AtOnce)Starts loading a scene by its key — Addresses.Scenes.Level — found by its identity wherever it is, then by its address, and says which it is; see SceneLoader.Load.
Parameters
scene: The key the build wrote for an addressable scene.mode: Whether the other scenes go once it is shown, or stay.hold: Whether to hold it, built, untilSceneAccess.Activate.pace: Whether it is shown all at once, or over several frames, a few entities at a time.
Activate
public void Activate(SceneId scene)Lets a scene held ready be shown.
Parameters
scene
Unload
public void Unload(SceneId scene, ScenePace pace = AtOnce)Starts unloading a scene: hidden at once and despawned a slice at a time, or despawned gradually and never hidden.
Parameters
scene: The scene to unload.pace: Whether it is hidden all at once first, or simply despawned over several frames.
StateOf
public SceneState StateOf(SceneId scene)Where a scene is: loading, held ready, shown, unloading, or none.
Parameters
scene
ProgressOf
public float ProgressOf(SceneId scene)How far a scene's load has got, from nothing to all of it.
Parameters
scene
