Skip to content

Scene ​

class in OpalScript

Find, spawn, and destroy entities in the current Play world.

Methods ​

MemberDescription
Scene.FindAllSnapshot all live scene entities in scene order, at most 1,024, charged to the script query budget.
Scene.FindInGroupSnapshot live entities whose trimmed Group or Team name matches the supplied trimmed name, in scene order. Disabled Team tags still match, and Health does not filter results. Empty matches all live entities. At most 1,024 matches; scanning is charged to the script query budget.
Scene.FindByNameFind the first live entity with this exact name in the current scene, or null.
Scene.FindByIdFind a live entity by its exact scene id, or null.
Scene.DestroyDuring Play, destroy an entity and its subtree through the world lifecycle. Null or expired references do nothing.
Scene.SpawnSpawn a referenced, preloaded prefab immediately during Play, or fail before activation when unavailable.
Scene.SpawnConfiguredSpawn a preloaded prefab before its Start hooks, calling this component's synchronous void initializer(Entity), or initializer(Entity, T) with a fourth typed payload. The initializer name must be a string literal. Payloads are immutable values or a single lifetime-checked Entity; mutable lists, components and task handles are excluded.
Scene.FindWithAn ordered snapshot of live entities with an enabled component T. At most 1,024 results; queries share the world index and script budgets.
Scene.FindInRadiusLive entities with an enabled component T whose world origins are within the inclusive radius of center. Scene order, at most 1,024 results. Radius must be finite and nonnegative.
Scene.FindNearestThe nearest live entity with an enabled component T within the inclusive radius of center, or null. Equal distances retain scene order. Radius must be finite and nonnegative; work is budgeted without allocating a result list.

See also ​