UMassEntitySubsystem

Choose your operating system:

Windows

macOS

Linux

Inheritance Hierarchy

References

Module

MassEntity

Header

/Engine/Plugins/Runtime/MassEntity/Source/MassEntity/Public/MassEntitySubsystem.h

Include

#include "MassEntitySubsystem.h"

Syntax

UCLASS()
class UMassEntitySubsystem : public UWorldSubsystem

Constructors

Name Description

Public function

UMassEntitySubsystem()

Functions

Name Description

Public function

void

 

AddCompositionToEntity_GetDelta

Adds fragments and tags indicated by InOutDescriptor to the Entity.

Public function

void

 

AddFragmentInstanceListToEntity

(
    FMassEntityHandle Entity,
    TConstArrayView< FInstancedStruct >...
)

Public function

void

 

AddFragmentListToEntity

(
    FMassEntityHandle Entity,
    TConstArrayView< const UScriptStruc...
)

Ensures that only unique fragments are added.

Public function

void

 

AddFragmentToEntity

(
    FMassEntityHandle Entity,
    const UScriptStruct* FragmentT...
)

Public function

void

 

AddTagToEntity

(
    FMassEntityHandle Entity,
    const UScriptStruct* TagType
)

Public function

TSharedRef< ...

 

BatchCreateEntities

(
    const FArchetypeHandle Archetype,
    const int32 Count,
    TArray< FMassEntityHandle >& OutEn...
)

A version of CreateEntity that's creating a number of entities (Count) at one go

Public function

void

 

BatchDestroyEntities

(
    TConstArrayView< FMassEntityHandle ...
)

Destroys all the entity in the provided array of entities

Public function

void

 

BatchDestroyEntityChunks

(
    const FArchetypeChunkCollection& C...
)

Public function Static

void

 

BatchSetEntityFragmentsValues

(
    const FArchetypeChunkCollection& S...,
    TArrayView< const FInstancedStruct ...
)

Copies values from FragmentInstanceList over to fragments of given entities collection.

Public function

void

 

BuildEntity

(
    FMassEntityHandle Entity,
    TConstArrayView< FInstancedStruct >...,
    FMassArchetypeSharedFragmentValues ...
)

Builds an entity for it to be ready to be used by the subsystem

Public function

void

 

BuildEntity

(
    FMassEntityHandle Entity,
    const FArchetypeHandle Archetype
)

Builds an entity for it to be ready to be used by the subsystem

Public function Const

void

 

CheckIfEntityIsActive

(
    FMassEntityHandle Entity
)

Asserts that IsEntityBuilt.

Public function Const

void

 

CheckIfEntityIsValid

(
    FMassEntityHandle Entity
)

Asserts that IsEntityValid.

Public function

FArchetypeHa...

 

CreateArchetype

(
    TConstArrayView< const UScriptStruc...
)

A special, relaxed but slower version of CreateArchetype functions that allows FragmentAngTagsList to contain both fragments and tags.

Public function

FArchetypeHa...

 

CreateArchetype

(
    const FMassArchetypeCompositionDesc...,
    const FMassArchetypeSharedFragmentV...
)

CreateArchetype from a composition descriptor and initial values

Public function

FArchetypeHa...

 

CreateArchetype

(
    const TSharedPtr< FMassArchetypeDat...,
    const FMassFragmentBitSet& NewFrag...
)

Creates an archetype like SourceArchetype + NewFragmentList.

Public function

FMassEntityH...

 

CreateEntity

(
    const FArchetypeHandle Archetype
)

Creates fully built entity ready to be used by the subsystem

Public function

FMassEntityH...

 

CreateEntity

(
    TConstArrayView< FInstancedStruct >...
)

Creates fully built entity ready to be used by the subsystem

Public function Const

FMassExecuti...

 

CreateExecutionContext

(
    const float DeltaSeconds
)

Creates and initializes a FMassExecutionContext instance.

Public function

void

 

DebugForceArchetypeDataVersionBump()

Public function Const

int32

 

DebugGetArchetypeEntitiesCount

(
    const FArchetypeHandle& Archetype
)

Public function Const

int32

 

DebugGetArchetypeEntitiesCountPerChunk

(
    const FArchetypeHandle& Archetype
)

Public function Const

void

 

DebugGetArchetypeFragmentTypes

(
    const FArchetypeHandle& Archetype,
    TArray< const UScriptStruct* >...
)

Public function Const

int32

 

DebugGetArchetypesCount()

Public function

void

 

DebugGetArchetypesStringDetails

(
    FOutputDevice& Ar,
    const bool bIncludeEmpty
)

Public function

void

 

DebugGetArchetypeStrings

(
    const FArchetypeHandle& Archetype,
    TArray< FName >& OutFragmentNames,
    TArray< FName >& OutTagNames
)

Public function Const

int32

 

DebugGetEntityCount()

Public function Const

FMassEntityH...

 

DebugGetEntityIndexHandle

(
    const int32 EntityIndex
)

Public function Static

void

 

DebugGetStringDesc

(
    const FArchetypeHandle& Archetype,
    FOutputDevice& Ar
)

Public function Const

void

 

DebugPrintArchetypes

(
    FOutputDevice& Ar,
    const bool bIncludeEmpty
)

Public function Const

void

 

DebugPrintEntity

(
    int32 Index,
    FOutputDevice& Ar,
    const TCHAR* InPrefix
)

Public function Const

void

 

DebugPrintEntity

(
    FMassEntityHandle Entity,
    FOutputDevice& Ar,
    const TCHAR* InPrefix
)

Public function

void

 

DebugRemoveAllEntities()

Public function Const

FMassCommand...

 

Defer()

Public function

void

 

DestroyEntity

(
    FMassEntityHandle Entity
)

Destroys a fully built entity, use ReleaseReservedEntity if entity was not yet built.

Public function

void

 

DoEntityCompaction

(
    const double TimeAllowed
)

Go through all archetypes and compact entities

Public function Static

void

 

ForEachArchetypeFragmentType

(
    const FArchetypeHandle Archetype,
    TFunction< void...
)

Method to iterate on all the fragment types of an archetype

Public function

void

 

ForEachSharedFragment

(
    TFunction< void > ExecuteFunct...
)

Public function Const

const FMassA...

 

GetArchetypeComposition

(
    const FArchetypeHandle& ArchetypeH...
)

Public function Const

uint32

 

GetArchetypeDataVersion()

Public function Const

FArchetypeHa...

 

GetArchetypeForEntity

(
    FMassEntityHandle Entity
)

Public function Const

FragmentType...

 

GetFragmentDataChecked

(
    FMassEntityHandle Entity
)

Public function Const

FragmentType...

 

GetFragmentDataPtr

(
    FMassEntityHandle Entity
)

Public function Const

FStructView

 

GetFragmentDataStruct

(
    FMassEntityHandle Entity,
    const UScriptStruct* FragmentT...
)

Public function

FMassObserve...

 

GetObserverManager()

Public function

FConstShared...

 

GetOrCreateConstSharedFragment

(
    const uint32 Hash,
    const T& Fragment
)

Shared fragment creation methods

Public function

FSharedStruc...

 

GetOrCreateSharedFragment

(
    const uint32 Hash,
    TArgs&&... InArgs
)

Protected function

void

 

GetValidArchetypes

(
    const FMassEntityQuery& Query,
    TArray< FArchetypeHandle >& OutVal...
)

Protected function

FArchetypeHa...

 

InternalCreateSiblingArchetype

(
    const TSharedPtr< FMassArchetypeDat...,
    const FMassTagBitSet& OverrideTags
)

Public function Const

bool

 

IsEntityActive

(
    FMassEntityHandle Entity
)

Return true if it is an valid built entity.

Public function Const

bool

 

IsEntityBuilt

(
    FMassEntityHandle Entity
)

Returns true if Entity is has been fully built (expecting a valid Entity)

Public function Const

bool

 

IsEntityValid

(
    FMassEntityHandle Entity
)

Returns true if Entity is valid.

Public function Const

bool

 

IsProcessing()

Public function

void

 

MoveEntityToAnotherArchetype

(
    FMassEntityHandle Entity,
    FArchetypeHandle NewArchetypeHandle
)

Moves an entity over to a new archetype by copying over fragments common to both archetypes

Public function

FScopedProce...

 

NewProcessingScope()

Public function

void

 

ReleaseReservedEntity

(
    FMassEntityHandle Entity
)

Releases a previously reserved entity that was not yet built, otherwise call DestroyEntity

Public function

void

 

RemoveCompositionFromEntity

(
    FMassEntityHandle Entity,
    const FMassArchetypeCompositionDesc...
)

Public function

void

 

RemoveFragmentFromEntity

(
    FMassEntityHandle Entity,
    const UScriptStruct* FragmentT...
)

Public function

void

 

RemoveFragmentListFromEntity

(
    FMassEntityHandle Entity,
    TConstArrayView< const UScriptStruc...
)

Public function

void

 

RemoveTagFromEntity

(
    FMassEntityHandle Entity,
    const UScriptStruct* TagType
)

Public function

FMassEntityH...

 

ReserveEntity()

Reserves an entity in the subsystem, the entity is still not ready to be used by the subsystem, need to call BuildEntity()

Public function

void

 

SetEntityFragmentsValues

(
    FMassEntityHandle Entity,
    TArrayView< const FInstancedStruct ...
)

Copies values from FragmentInstanceList over to Entity's fragment.

Public function

void

 

SwapTagsForEntity

(
    FMassEntityHandle Entity,
    const UScriptStruct* FromFragm...,
    const UScriptStruct* ToFragmen...
)

Overridden from UWorldSubsystem

Name Description

Public function Virtual

void

 

PostInitialize()

Called once all UWorldSubsystems have been initialized

Overridden from USubsystem

Name Description

Public function Virtual

void

 

Deinitialize()

Implement this for deinitialization of instances of the system

Public function Virtual

void

 

Initialize

(
    FSubsystemCollectionBase& Collecti...
)

Implement this for initialization of instances of the system

Overridden from UObject

Name Description

Public function Virtual

void

 

GetResourceSizeEx

(
    FResourceSizeEx& CumulativeResourc...
)

Get the size of the object/resource for use in memory tools or to display to artists/LDs in the Editor This is the extended version which separates up the used memory into different memory regions (the actual definition of which may be platform specific).

Classes

Name

Description

Public struct

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.

Public struct

FScopedProcessing

Constants

Name

Description

InvalidEntity

NumReservedEntities

Index 0 is reserved so we can treat that index as an invalid entity handle.