Navigation
API > API/Plugins > API/Plugins/MassEntity
Inheritance Hierarchy
- TSharedFromThis< FMassEntityManager >
- 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 | AddFragmentToEntity
(
FMassEntityHandle Entity, |
||
| void | AddReferencedObjects
(
FReferenceCollector& Collector |
||
| void | AddTagToEntity
(
FMassEntityHandle Entity, |
||
| void | AppendCommands
(
TSharedPtr< FMassCommandBuffer >& InOutCommandBuffer |
Depending on the current state of Manager's command buffer the function will either move all the commands out of InOutCommandBuffer into the main command buffer or append it to the list of command buffers waiting to be flushed. | |
| void | BatchAddFragmentInstancesForEntities
(
TConstArrayView< FMassArchetypeEntityCollectionWithPayload > EntityCollections, |
||
| void | BatchBuildEntities
(
const FMassArchetypeEntityCollectionWithPayload& EncodedEntitiesWithPayload, |
||
| void | BatchBuildEntities
(
const FMassArchetypeEntityCollectionWithPayload& EncodedEntitiesWithPayload, |
||
| void | BatchBuildEntities
(
const FMassArchetypeEntityCollectionWithPayload& EncodedEntitiesWithPayload, |
||
| 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, |
||
| TSharedRef< FEntityCreationContext > | BatchCreateReservedEntities
(
const FMassArchetypeHandle& ArchetypeHandle, |
A version of CreateEntity that's creating a number of entities (Count) in one go | |
| TSharedRef< FEntityCreationContext > | BatchCreateReservedEntities
(
const FMassArchetypeHandle& ArchetypeHandle, |
||
| 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
(
TConstArrayView< const UScriptStruct* > FragmentsAndTagsList, |
DEPRECATED. | |
| FMassArchetypeHandle | CreateArchetype
(
const TSharedPtr< FMassArchetypeData >& SourceArchetype, |
||
| FMassArchetypeHandle | CreateArchetype
(
FMassArchetypeHandle SourceArchetype, |
||
| FMassArchetypeHandle | CreateArchetype
(
const TSharedPtr< FMassArchetypeData >& SourceArchetype, |
Creates an archetype like SourceArchetype + InFragments. | |
| FMassArchetypeHandle | CreateArchetype
(
TConstArrayView< const UScriptStruct* > FragmentsAndTagsList, |
A special, relaxed but slower version of CreateArchetype functions that allows FragmentAngTagsList to contain both fragments and tags. | |
| FMassArchetypeHandle | CreateArchetype
(
FMassArchetypeHandle SourceArchetype, |
A special, relaxed but slower version of CreateArchetype functions that allows FragmentAngTagsList to contain both fragments and tags. | |
| FMassArchetypeHandle | CreateArchetype
(
const FMassArchetypeCompositionDescriptor& Composition, |
||
| FMassEntityHandle | CreateEntity
(
TConstArrayView< FInstancedStruct > FragmentInstanceList, |
Creates fully built entity ready to be used by the subsystem | |
| FMassEntityHandle | CreateEntity
(
TConstArrayView< FInstancedStruct > FragmentInstanceList, |
||
| 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
(
TFunctionRef< void(T&) > ExecuteFunction |
||
| void | ForEachSharedFragmentConditional
(
TFunctionRef< bool(T&) > ConditionFunction, |
||
| 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. | |
| ConstSharedFragmentType & | |||
| ConstSharedFragmentType * | GetConstSharedFragmentDataPtr
(
FMassEntityHandle Entity |
||
| FConstStructView | GetConstSharedFragmentDataStruct
(
FMassEntityHandle Entity, |
||
| FragmentType & | GetFragmentDataChecked
(
FMassEntityHandle Entity |
||
| FragmentType * | GetFragmentDataPtr
(
FMassEntityHandle Entity |
||
| FStructView | GetFragmentDataStruct
(
FMassEntityHandle Entity, |
||
| void | GetMatchingArchetypes
(
const FMassFragmentRequirements& Requirements, |
||
| FMassObserverManager & | |||
| FOnNewArchetypeDelegate & | |||
| const FConstSharedStruct & | GetOrCreateConstSharedFragment
(
const T& Fragment |
||
| const FConstSharedStruct & | GetOrCreateConstSharedFragmentByHash
(
const uint32 Hash, |
Shared fragment creation methods | |
| const FSharedStruct & | GetOrCreateSharedFragmentByHash
(
const uint32 Hash, |
||
| UObject * | GetOwner () |
||
| FString | |||
| FMassRequirementAccessDetector & | |||
| void | GetResourceSizeEx
(
FResourceSizeEx& CumulativeResourceSize |
||
| SharedFragmentType & | GetSharedFragmentDataChecked
(
FMassEntityHandle Entity |
||
| SharedFragmentType * | GetSharedFragmentDataPtr
(
FMassEntityHandle Entity |
||
| FConstStructView | GetSharedFragmentDataStruct
(
FMassEntityHandle Entity, |
||
| TConstArrayView< FSharedStruct > | |||
| 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, |
||
| 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, |
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 | |
| FStructInitializationCallback |
Constants
| Name | Description |
|---|---|
| InvalidEntity | |
| NumReservedEntities | Index 0 is reserved so we can treat that index as an invalid entity handle. |
See Also
FMassCommandBuffer for more details.