Navigation
API > API/Plugins > API/Plugins/MassEntity
Inheritance Hierarchy
- TSharedFromThis
- FGCObject
- FMassEntityManager
References
| Module | MassEntity |
| Header | /Engine/Plugins/Runtime/MassEntity/Source/MassEntity/Public/MassEntityManager.h |
| Include | #include "MassEntityManager.h" |
Syntax
struct FMassEntityManager :
public TSharedFromThis< FMassEntityManager >,
public FGCObject
Remarks
The type responsible for hosting Entities managing Archetypes. Entities are stored as FEntityData entries in a chunked array. Each valid entity is assigned to an Archetype that stored fragments associated with a given entity at the moment.
FMassEntityManager supplies API for entity creation (that can result in archetype creation) and entity manipulation. Even though synchronized manipulation methods are available in most cases the entity operations are performed via a command buffer. The default command buffer can be obtained with a Defer() call. FMassEntityManager are meant to be stored with a TSharedPtr or TSharedRef. Some of Mass API pass around FMassEntityManager& but programmers can always use AsShared() call to obtain a shared ref for a given manager instance (as supplied by deriving from TSharedFromThis
Variables
| Type | Name | Description | |
|---|---|---|---|
| friend | FMassDebugger | ||
| friend | FMassEntityQuery |
Constructors
| Type | Name | Description | |
|---|---|---|---|
FMassEntityManager
(
UObject* InOwner |
|||
FMassEntityManager
(
const FMassEntityManager& Other |
Destructors
| Type | Name | Description | |
|---|---|---|---|
Functions
| Type | Name | Description | |
|---|---|---|---|
| void | AddCompositionToEntity_GetDelta
(
FMassEntityHandle Entity, |
Adds fragments and tags indicated by InOutDescriptor to the Entity. | |
| void | AddFragmentInstanceListToEntity
(
FMassEntityHandle Entity, |
||
| void | AddFragmentListToEntity
(
FMassEntityHandle Entity, |
Ensures that only unique fragments are added. | |
| void | AddFragmentToEntity
(
FMassEntityHandle Entity, |
||
| void | AddTagToEntity
(
FMassEntityHandle Entity, |
||
| void | BatchAddFragmentInstancesForEntities
(
TConstArrayView< FMassArchetypeEntityCollectionWithPayload > EntityCollections, |
||
| void | BatchBuildEntities
(
const FMassArchetypeEntityCollectionWithPayload& EncodedEntitiesWithPayload, |
Public name, available to the world. | |
| void | BatchBuildEntities
(
const FMassArchetypeEntityCollectionWithPayload& EncodedEntitiesWithPayload, |
||
| void | BatchChangeFragmentCompositionForEntities
(
TConstArrayView< FMassArchetypeEntityCollection > EntityCollections, |
||
| void | BatchChangeTagsForEntities
(
TConstArrayView< FMassArchetypeEntityCollection > EntityCollections, |
||
| TSharedRef< FEntityCreationContext > | BatchCreateEntities
(
const FMassArchetypeHandle& ArchetypeHandle, |
A version of CreateEntity that's creating a number of entities (Count) in one go | |
| TSharedRef< FEntityCreationContext > | BatchCreateEntities
(
const FMassArchetypeHandle& ArchetypeHandle, |
A version of CreateEntity that's creating a number of entities (Count) in one go | |
| TSharedRef< FEntityCreationContext > | BatchCreateReservedEntities
(
const FMassArchetypeHandle& ArchetypeHandle, |
||
| TSharedRef< FEntityCreationContext > | BatchCreateReservedEntities
(
const FMassArchetypeHandle& ArchetypeHandle, |
A version of CreateEntity that's creating a number of entities (Count) in one go | |
| void | BatchDestroyEntities
(
TConstArrayView< FMassEntityHandle > InEntities |
Destroys all the entity in the provided array of entities | |
| void | BatchDestroyEntityChunks
(
const FMassArchetypeEntityCollection& Collection |
||
| void | BatchSetEntityFragmentsValues
(
const FMassArchetypeEntityCollection& SparseEntities, |
Copies values from FragmentInstanceList over to fragments of given entities collection. | |
| void | BuildEntity
(
FMassEntityHandle Entity, |
Builds an entity for it to be ready to be used by the subsystem | |
| void | BuildEntity
(
FMassEntityHandle Entity, |
Builds an entity for it to be ready to be used by the subsystem | |
| void | CheckIfEntityIsActive
(
FMassEntityHandle Entity |
Asserts that IsEntityBuilt. | |
| void | CheckIfEntityIsValid
(
FMassEntityHandle Entity |
Asserts that IsEntityValid. | |
| FMassArchetypeHandle | CreateArchetype
(
const FMassArchetypeCompositionDescriptor& Composition, |
CreateArchetype from a composition descriptor and initial values | |
| FMassArchetypeHandle | CreateArchetype
(
const TSharedPtr< FMassArchetypeData >& SourceArchetype, |
Creates an archetype like SourceArchetype + InFragments. | |
| FMassArchetypeHandle | CreateArchetype
(
FMassArchetypeHandle SourceArchetype, |
A special, relaxed but slower version of CreateArchetype functions that allows FragmentAngTagsList to contain both fragments and tags. | |
| FMassArchetypeHandle | CreateArchetype
(
TConstArrayView< const UScriptStruct* > FragmentsAndTagsList, |
A special, relaxed but slower version of CreateArchetype functions that allows FragmentAngTagsList to contain both fragments and tags. | |
| FMassEntityHandle | CreateEntity
(
TConstArrayView< FInstancedStruct > FragmentInstanceList, |
Creates fully built entity ready to be used by the subsystem | |
| FMassEntityHandle | CreateEntity
(
const FMassArchetypeHandle& ArchetypeHandle, |
Creates fully built entity ready to be used by the subsystem | |
| FMassExecutionContext | CreateExecutionContext
(
const float DeltaSeconds |
Creates and initializes a FMassExecutionContext instance. | |
| void | |||
| int32 | DebugGetArchetypeEntitiesCount
(
const FMassArchetypeHandle& Archetype |
||
| int32 | DebugGetArchetypeEntitiesCountPerChunk
(
const FMassArchetypeHandle& Archetype |
||
| void | DebugGetArchetypeFragmentTypes
(
const FMassArchetypeHandle& Archetype, |
||
| int32 | |||
| void | DebugGetArchetypesStringDetails
(
FOutputDevice& Ar, |
||
| void | DebugGetArchetypeStrings
(
const FMassArchetypeHandle& Archetype, |
||
| int32 | |||
| FMassEntityHandle | DebugGetEntityIndexHandle
(
const int32 EntityIndex |
||
| const FString & | DebugGetName () |
||
| void | DebugPrintArchetypes
(
FOutputDevice& Ar, |
||
| void | |||
| FMassCommandBuffer & | Defer () |
||
| void | Deinitialize () |
||
| void | DestroyEntity
(
FMassEntityHandle Entity |
Destroys a fully built entity, use ReleaseReservedEntity if entity was not yet built. | |
| void | DoEntityCompaction
(
const double TimeAllowed |
Go through all archetypes and compact entities | |
| void | FlushCommands
(
const TSharedPtr< FMassCommandBuffer >& InCommandBuffer |
||
| void | ForEachArchetypeFragmentType
(
const FMassArchetypeHandle& ArchetypeHandle, |
Method to iterate on all the fragment types of an archetype | |
| void | ForEachSharedFragment
(
TFunction< void(T&) > ExecuteFunction |
||
| const FMassArchetypeCompositionDescriptor & | GetArchetypeComposition
(
const FMassArchetypeHandle& ArchetypeHandle |
||
| uint32 | |||
| FMassArchetypeHandle | GetArchetypeForEntity
(
FMassEntityHandle Entity |
Fetches the archetype for a given Entity. | |
| FMassArchetypeHandle | GetArchetypeForEntityUnsafe
(
FMassEntityHandle Entity |
Fetches the archetype for a given Entity. | |
| FragmentType & | GetFragmentDataChecked
(
FMassEntityHandle Entity |
||
| FragmentType * | GetFragmentDataPtr
(
FMassEntityHandle Entity |
||
| FStructView | GetFragmentDataStruct
(
FMassEntityHandle Entity, |
||
| FMassObserverManager & | |||
| FOnNewArchetypeDelegate & | |||
| FConstSharedStruct & | GetOrCreateConstSharedFragment
(
const T& Fragment |
||
| FConstSharedStruct & | GetOrCreateConstSharedFragmentByHash
(
const uint32 Hash, |
Shared fragment creation methods | |
| FSharedStruct & | GetOrCreateSharedFragmentByHash
(
const uint32 Hash, |
||
| UObject * | GetOwner () |
||
| FMassRequirementAccessDetector & | |||
| void | GetResourceSizeEx
(
FResourceSizeEx& CumulativeResourceSize |
||
| void | GetValidArchetypes
(
const FMassEntityQuery& Query, |
||
| UWorld * | GetWorld () |
Fetches the world associated with the Owner. | |
| void | Initialize () |
||
| void | InternalAppendFragmentsAndTagsToArchetypeCompositionDescriptor
(
FMassArchetypeCompositionDescriptor& InOutComposition, |
||
| FMassArchetypeHandle | InternalCreateSimilarArchetype
(
const FMassArchetypeData& SourceArchetypeRef, |
||
| FMassArchetypeHandle | InternalCreateSimilarArchetype
(
const TSharedPtr< FMassArchetypeData >& SourceArchetype, |
A "similar" archetype is an archetype exactly the same as SourceArchetype except for one composition aspect like Fragments or "Tags" | |
| FMassArchetypeHandle | InternalCreateSimilarArchetype
(
const TSharedPtr< FMassArchetypeData >& SourceArchetype, |
A "similar" archetype is an archetype exactly the same as SourceArchetype except for one composition aspect like Fragments or "Tags" | |
| bool | IsEntityActive
(
FMassEntityHandle Entity |
Return true if it is an valid built entity. | |
| bool | IsEntityBuilt
(
FMassEntityHandle Entity |
Returns true if Entity is has been fully built (expecting a valid Entity) | |
| bool | IsEntityValid
(
FMassEntityHandle Entity |
Returns true if Entity is valid. | |
| bool | IsProcessing () |
Indicates whether there are processors out there performing operations on this instance of MassEntityManager. | |
| void | MoveEntityToAnotherArchetype
(
FMassEntityHandle Entity, |
Moves an entity over to a new archetype by copying over fragments common to both archetypes | |
| FScopedProcessing | |||
| void | |||
| void | ReleaseReservedEntity
(
FMassEntityHandle Entity |
Releases a previously reserved entity that was not yet built, otherwise call DestroyEntity | |
| void | RemoveCompositionFromEntity
(
FMassEntityHandle Entity, |
||
| void | RemoveFragmentFromEntity
(
FMassEntityHandle Entity, |
||
| void | RemoveFragmentListFromEntity
(
FMassEntityHandle Entity, |
||
| void | RemoveTagFromEntity
(
FMassEntityHandle Entity, |
||
| FMassEntityHandle | Reserves an entity in the subsystem, the entity is still not ready to be used by the subsystem, need to call BuildEntity() | ||
| void | SetDebugName
(
const FString& NewDebugGame |
||
| void | SetEntityFragmentsValues
(
FMassEntityHandle Entity, |
Copies values from FragmentInstanceList over to Entity's fragment. | |
| void | SwapTagsForEntity
(
FMassEntityHandle Entity, |
Overridden from FGCObject
| Type | Name | Description | |
|---|---|---|---|
| void | AddReferencedObjects
(
FReferenceCollector& Collector |
Pure virtual that must be overloaded by the inheriting class. | |
| FString | Overload this method to report a name for your referencer |
Classes
| Type | Name | Description | |
|---|---|---|---|
| FEntityCreationContext | A dedicated structure for ensuring the "on entities creation" observers get notified only once all other initialization operations are done and this creation context instance gets released. | ||
| FScopedProcessing |
Typedefs
| Name | Description |
|---|---|
| FOnNewArchetypeDelegate |
Constants
| Name | Description |
|---|---|
| InvalidEntity | |
| NumReservedEntities | Index 0 is reserved so we can treat that index as an invalid entity handle. |
See Also
FMassCommandBufferfor more details.