class GameObject

Type of object that can be referenced by a GameObject handle.

Each object has an unique ID and is registered with the GameObjectManager.

Public

Constructors

GameObject

GameObject() noexcept(false) = default

Methods

~GameObject

virtual ~GameObject() noexcept = default

GetId

const UUID &GetId() const

Globally unique identifier of the game object that persists scene save/load.

GetName

const String &GetName() const

Gets the name of the object.

SetName

void SetName(const String &name)

Sets the name of the object.

HasGameObjectFlag

bool HasGameObjectFlag(GameObjectTransientFlag flag) const

Checks is the particular object flag set.

SetGameObjectFlag

void SetGameObjectFlag(GameObjectTransientFlag flag)

Sets a particular flag on the game object.

UnsetGameObjectFlag

void UnsetGameObjectFlag(GameObjectTransientFlag flag)

Removes a particular flag on the game object.

HasGameObjectFlag

bool HasGameObjectFlag(GameObjectPersistentFlag flag) const

Checks is the particular object flag set.

SetGameObjectFlag

void SetGameObjectFlag(GameObjectPersistentFlag flag)

Sets a particular flag on the game object.

UnsetGameObjectFlag

void UnsetGameObjectFlag(GameObjectPersistentFlag flag)

Removes a particular flag on the game object.

GetPrefabObjectId

const UUID &GetPrefabObjectId() const

Identifies the equivalent object in the linked prefab.

This will be an empty ID if the object is not linked to a prefab.

IsPrefabInstance

bool IsPrefabInstance() const

Returns true if this object is linked to a prefab.

This generally means the object was created as a copy of some prefab, or the prefab was created from this object.

GetECSRegistry

ecs::Registry *GetECSRegistry() const override

Returns the ECS registry this entity belongs to, or null if not part of a registry.

GetECSEntity

ecs::Entity GetECSEntity() const override

Returns the ECS entity handle.

staticGetRttiStatic

static RTTIType *GetRttiStatic()

GetRtti

RTTIType *GetRtti() const override

Returns an interface you can use to access class' Run Time Type Information.

Internal

Methods

SetId

void SetId(const UUID &id)

SetPrefabObjectId

void SetPrefabObjectId(const UUID &id)

SetInstanceData

void SetInstanceData(const SPtr<GameObjectInstanceData> &other)

Replaces the instance data with another object's instance data.

This object will basically become the original owner of the provided instance data as far as all game object handles referencing it are concerned.

GetInstanceData

virtual const SPtr<GameObjectInstanceData> &GetInstanceData() const

Returns instance data that identifies this GameObject and is used for referencing by game object handles.

GetOwnerCollection

const WeakSPtr<GameObjectCollection> &GetOwnerCollection() const

Returns the collection that this game object is a part of.

SetOwnerCollection

virtual void SetOwnerCollection(const SPtr<GameObjectCollection> &collection)

Changes the collection the game object is part of.

Game object will be unregistered with the old collection (if any) and registered with the new collection.

DestroyImmediate

virtual void DestroyImmediate()

Destroys the game object without delay.

Object will be removed from its game object collection, and reference to the object in all active handles will become null. If the object contains any child objects or components, those will be destroyed as well.

QueueForDestroy

virtual void QueueForDestroy()

Queues the provided game object to be destroyed at the end of the frame.

If the object contains any child objects or components, those will be queued for destroy as well. Object will not be removed from any parent's child or component list.

Protected

Methods

InitializeInstanceData

void InitializeInstanceData(const SPtr<GameObject> &object)

Initializes instance data and assigns the GameObject after construction.

Fields

mName

String mName

mThisHandle

HGameObject mThisHandle

mId

UUID mId

Unique identifier for this object.

mPrefabObjectId

UUID mPrefabObjectId

Identifier of the object in the prefab that this object is linked to, if any.

mOwnerCollection

WeakSPtr<GameObjectCollection> mOwnerCollection

Collection that owns this game object.

mTransientGameObjectFlags

GameObjectTransientFlags mTransientGameObjectFlags

mPersistentGameObjectFlags

GameObjectPersistentFlags mPersistentGameObjectFlags

mRTTIData

Any mRTTIData

mECSRegistry

ecs::Registry * mECSRegistry

mECSEntity

ecs::Entity mECSEntity

Private

Fields

mInstanceData

SPtr<GameObjectInstanceData> mInstanceData