Skip to content

Class EngineObject

Namespace: Apogee.Reflection
Assembly: Apogee.Reflection.dll

The base class of everything scripts can hold. Every object has a (index and generation) in one table: scripts keep the handle, never the object, so a destroyed object is recognised and cannot be used by accident. Derived classes are partial and marked ; the source generator writes .

public abstract class EngineObject

Inheritance

object ← EngineObject

Derived

AssetLibrary, AudioBus, AudioSound, AudioSystem, AudioVoice, BodyDesc, CharacterController, Hitch, InputActionMap, InputActionRouter, ModelLibrary, NetConnection, NetSystem, PhysicsShape, PhysicsWorld, SettingsStore, SteamSystem, Tween, UiDataModel, UiElement, UiEvent, UiSystem, Vehicle, VehicleDesc, WheelDesc, World

Inherited Members

object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.MemberwiseClone(), object.ReferenceEquals(object?, object?), object.ToString()

Constructors

EngineObject()

protected EngineObject()

Properties

Class

What the registry knows about this object's class.

public abstract ClassInfo Class { get; }

Property Value

ClassInfo

Handle

Null once the object is destroyed.

public SlotHandle Handle { get; }

Property Value

SlotHandle

IsAdopted

True once the engine has taken the object over (put it in a world, a scene, a list it owns). An object a script creates is destroyed when the script no longer holds it, unless the engine adopted it.

public bool IsAdopted { get; }

Property Value

bool

IsDestroyed

public bool IsDestroyed { get; }

Property Value

bool

Methods

Adopt()

Takes the object over from the script that created it: it now lives until .

public void Adopt()

Destroy()

Ends the object's life: its handle stops resolving, in scripts too. Does nothing when it is already destroyed.

public void Destroy()

OnDestroyed()

protected virtual void OnDestroyed()

TryGet(SlotHandle, out EngineObject)

Finds a live object by the handle a script holds.

public static bool TryGet(SlotHandle handle, out EngineObject item)

Parameters

handle SlotHandle

item EngineObject

Returns

bool