Scene
Summary
Scene object that contains all actors and lifecycle.
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 catastrophical failures as the engine is not designed for this.
Important
This class 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 | Throws an ObjectDisposedException if this is null. |
public get; Name |
String |
NativeHandle Remarks
Warning
Not for public access, usually not needed anyway.
Methods
public static Scene CreateEmptyScene(String? name)
Summary: Creates an empty scene with no actors.
Parameters:
name(String?): Optional debug name
Returns:
public Void Start()
public Void Stop()
public Void Reparent(Actor newParent, Actor child)
Parameters:
public Actor CreateEmptyActor(String? name, Boolean isStationary)
Parameters:
Returns:
public Actor? CreatePrefabActor(PrefabAsset prefab, String? name, Boolean isStationary, Object? payload)
Summary: Creates an actor from a prefab asset. This will instantiate a new instance of actors from the prefab chain, and optionally initialise a script if the prefab has one.
Parameters:
-
prefab(PrefabAsset): Prefab asset to create the actor from -
name(String?): Optional actor name, if null, no name is given. -
isStationary(Boolean): Advanced: if the actor should be treated as a stationary object. This means the actor is NOT allowed to alter positions or state. -
payload(Object?): Optional script payload that is provided in the ActorScript.OnCreate function
Returns:
- Actor?: A valid actor if the instantiation was NOT veto'd
public Actor? GetActorFromId(UInt64 id)
Summary: Gets an actor from an ID relative to the scene root.
Parameters:
id(UInt64): The ID relative to the scene root
Returns:
- Actor?: A valid actor if an actor with the ID exists
public Actor? GetActorFromGuid(Guid guid)
Summary: Gets an actor from an absolute GUID.
Parameters:
guid(Guid): The GUID of the actor
Returns:
- Actor?: A valid actor if an actor with the GUID exists
public IEnumerable<TScript> EnumerateActorsOfScript<TScript>(Boolean canBeDerived)
Parameters:
canBeDerived(Boolean):
Returns:
public IEnumerable<Actor> EnumerateActorsWithComponent<TComponent>(TComponent component)
Parameters:
component(TComponent):
Returns:
public Void KillActor(Actor actor)
Parameters:
actor(Actor):
public Void Dispose()
Summary: Releases all scene resources and destroys all actors.
public virtual Boolean Equals(Object? obj)
Parameters:
obj(Object?):
Returns:
public virtual Int32 GetHashCode()
Returns:
public virtual String ToString()
Returns: