Actor
Summary
Represents an entity in the scene hierarchy with associated lifecycle, components, and hierarchy management.
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.
Definition
Namespace: SDT4.Managed.Core
Assembly: SDT4.Managed.Core.dll
class Actor
Inheritance:
Object ➔ Actor
Implements:
Fields
| Name | Type | Description |
|---|---|---|
public readonly Handle |
ActorHandle | The underlying handle referencing this actor instance within its owning scene. |
Properties
| Name | Type | Description |
|---|---|---|
public get; NativeHandle |
UInt32 | Gets the underlying native entity identifier. |
public get; Scene |
Scene | Gets the scene in which this actor resides. |
public get; GlobalId |
Guid | Gets the persistent globally unique identifier of this actor. |
public get; ScopeId |
Guid | Gets the unique identifier of the scope hierarchy that contains this actor. |
public get; LocalId |
UInt64 | Gets the scope-local identifier of this actor. |
public get; Name |
String | Gets the display or debug name of this actor, or |
public get; Mobility |
Mobility | Gets the mobility state of this actor (e.g. static, stationary, or dynamic). |
public get; IsValid |
Boolean | Gets a value indicating whether the actor represents an active, valid entity within the scene. |
public get; ScopeRoot |
Nullable<ActorHandle> | Gets the root actor handle of the current hierarchy scope, or |
public get; Parent |
Nullable<ActorHandle> | Gets the handle of this actor's direct parent in the transform hierarchy, or |
public get; Children |
ActorHandle[] | Gets an array of handles representing all direct children of this actor in the hierarchy. |
public get; Components |
IActorComponent[] | Gets an array containing all components currently attached to this actor. |
Methods
public Boolean HasComponent<T>()
Summary: Determines whether this actor has a component of the specified type attached.
Returns:
- Boolean:
if the component is present; otherwise, .
public T GetComponent<T>()
Summary: Retrieves the attached component of the specified type.
Returns:
- T: The component instance.
public Boolean TryGetComponent<T>(out T component)
Summary: Attempts to retrieve an attached component of the specified type.
Parameters:
component(T): When this method returns, contains the component instance if found; otherwise,.
Returns:
- Boolean:
if the component was found; otherwise, .
public T AddComponent<T>()
Summary: Instantiates and attaches a new component of the specified type to this actor.
Returns:
- T: The newly created component instance.
public Boolean RemoveComponent<T>()
Summary: Removes the component of the specified type from this actor.
Returns:
- Boolean:
if the component was found and removed; otherwise, .
public Nullable<ActorHandle> GetActorByLocalIdInScope(UInt64 localId)
Summary: Resolves an actor handle within the same hierarchy scope matching a scope-local identifier.
Parameters:
localId(UInt64): The scope-local identifier of the target actor.
Returns:
- Nullable<ActorHandle>: The matching actor handle, or
if no matching actor exists in scope.
public ActorHandle CreateEmptyActorInScope(String? name)
Summary: Spawns a new empty actor belonging to the current actor's hierarchy scope.
Parameters:
name(String?): The optional debug or display name to assign to the new actor.
Returns:
- ActorHandle: The handle of the newly created actor.
public virtual Boolean Equals(Object? obj)
Summary: Determines whether the specified object is an Actor and matches this instance.
Parameters:
obj(Object?): The object to compare with this instance.
Returns:
public Boolean Equals(Actor other)
Summary: Determines whether the specified Actor references the same native entity and scene.
Parameters:
other(Actor): The actor to compare with this instance.
Returns:
- Boolean:
if both instances reference the same native entity within the same scene; otherwise, .
public virtual Int32 GetHashCode()
Summary: Returns the hash code for this actor.
Returns:
- Int32: A 32-bit signed integer hash code.
public virtual String ToString()
Summary: Returns a formatted string representation of this actor.
Returns:
- String: A string identifying the actor and its handle state.