Scene

Summary

Represents the primary scene graph container managing actor hierarchies, components, and execution lifecycles.

Remarks

Danger

All calls made within this class MUST be performed on the Master Thread. See Threads.RunLater on how to safely call this from an asynchronous thread. Failure to comply with this can cause catastrophic failures as the engine is not designed for concurrent scene mutation.

Important

Instances of this class manage native engine allocations and MUST be disposed manually.

Definition

Namespace: SDT4.Managed.Core
Assembly: SDT4.Managed.Core.dll

class Scene
Inheritance:

Object ➔ Scene

Implements:

IDisposable, IDisposeTracker<Scene>

Fields

Name Type Description

Properties

Name Type Description
public get; NativeHandle IntPtr Gets the pointer to the underlying native engine scene.
public get; Name String Gets the display name of this scene, or if unnamed.
NativeHandle Remarks

Warning

Intended for internal engine interop; direct access by user scripts is typically unnecessary.


Methods

public static Scene CreateEmptyScene(String? name)

Summary: Creates a new empty scene containing no actors.

Parameters:

Returns:


public Void Start()

Summary: Starts the scene runtime, transitioning all active actors and scripts into their execution state.


public Void Stop()

Summary: Stops the scene runtime, terminating ticking and active script execution.


public Void ParentActor(ActorHandle child, Nullable<ActorHandle> parent)

Summary: Attaches a child actor to a specified parent actor in the hierarchy. If the child is already parented, it is unparented first.

Parameters:


public ActorHandle CreateEmptyActor(String? name)

Summary: Spawns a new empty actor within the root scope of this scene.

Parameters:

Returns:


public Nullable<ActorHandle> CreatePrefabActor(PrefabAsset prefab, String? name, Object? payload)

Summary: Instantiates an actor hierarchy from a prefab asset into this scene, optionally initialising its attached script.

Parameters:

Returns:


public Nullable<ActorHandle> GetActorFromId(UInt64 id)

Summary: Resolves an actor handle using an integer identifier relative to the scene root.

Parameters:

Returns:


public Nullable<ActorHandle> GetActorFromGuid(Guid guid)

Summary: Resolves an actor handle matching a globally unique identifier.

Parameters:

Returns:


public IEnumerable<TComponent> EnumerateComponents<TComponent>()

Summary: Enumerates all active components of the specified type across all actors in this scene.

Returns:


public IEnumerable<ActorHandle> EnumerateActorsByName(String name)

Summary: Enumerates all actor handles in this scene that match a specified name string.

Parameters:

Returns:


public IEnumerable<TActor> EnumerateActorsWithScript<TActor>()

Summary: Enumerates all active actor scripts in this scene matching the specified script type.

Returns:


public Void KillActor(ActorHandle actor)

Summary: Destroys the specified actor and cleans up its components, hierarchy bindings, and script instances.

Parameters:


public Void Dispose()

Summary: Releases all unmanaged scene resources and destroys all associated actors.


public virtual Boolean Equals(Object? obj)

Summary: Determines whether the specified object is a Scene referencing the same native scene instance.

Parameters:

Returns:


public virtual Int32 GetHashCode()

Summary: Returns the hash code for this scene based on its native pointer address.

Returns:


public virtual String ToString()

Summary: Returns a formatted string representation of this scene.

Returns: