FMassEntityQuery

[FMassEntityQuery](API\Plugins\MassEntity\FMassEntityQuery) is a structure that serves two main purposes:

Choose your operating system:

Windows

macOS

Linux

References

Module

MassEntity

Header

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

Include

#include "MassEntityQuery.h"

Syntax

USTRUCT()
struct FMassEntityQuery

Remarks

FMassEntityQuery is a structure that serves two main purposes:

Describe properties required of an archetype that's a subject of calculations

Trigger calculations on cached set of valid archetypes as described by Requirements

A query to be considered valid needs declared at least one EMassFragmentPresence::All, EMassFragmentPresence::AnyEMassFragmentPresence::Optional fragment requirement.

Variables

Constructors

Name Description

Public function

FMassEntityQuery()

Public function

FMassEntityQuery

(
    std::initializer_list< UScriptStruc...
)

Public function

FMassEntityQuery

(
    TConstArrayView< const UScriptStruc...
)

Functions

Name Description

Public function

FMassEntityQ...

 

AddChunkRequirement

(
    const EMassFragmentAccess AccessMod...,
    const EMassFragmentPresence Presenc...
)

Public function

FMassEntityQ...

 

AddConstSharedRequirement

(
    const EMassFragmentPresence Presenc...
)

Public function

FMassEntityQ...

 

AddRequirement

(
    const EMassFragmentAccess AccessMod...,
    const EMassFragmentPresence Presenc...
)

FMassEntityQuery ref returned for chaining

Public function

FMassEntityQ...

 

AddRequirement

(
    const UScriptStruct* FragmentT...,
    const EMassFragmentAccess AccessMod...,
    const EMassFragmentPresence Presenc...
)

Public function

FMassEntityQ...

 

AddSharedRequirement

(
    const EMassFragmentAccess AccessMod...,
    const EMassFragmentPresence Presenc...
)

Public function

FMassEntityQ...

 

AddTagRequirement

(
    const EMassFragmentPresence Presenc...
)

Public function

void

 

AddTagRequirement

(
    const UScriptStruct& TagType,
    const EMassFragmentPresence Presenc...
)

Public function

FMassEntityQ...

 

AddTagRequirements

(
    const FMassTagBitSet& TagBitSet
)

Actual implementation in specializations

Public function

void

 

CacheArchetypes

(
    UMassEntitySubsystem& InEntitySubs...
)

Will gather all archetypes from InEntitySubsystem matching this->Requirements.

Public function Const

bool

 

CheckValidity()

The function validates requirements we make for queries.

Public function

void

 

Clear()

Public function

void

 

ClearArchetypeFilter()

Public function

void

 

ClearChunkFilter()

Public function Const

FString

 

DebugGetArchetypeCompatibilityDescription

(
    const FArchetypeHandle& ArchetypeH...
)

Public function Const

FString

 

DebugGetDescription()

Public function

void

 

DirtyCachedData()

Public function Const

bool

 

DoesArchetypeMatchRequirements

(
    const FArchetypeHandle& ArchetypeH...
)

Public function

void

 

ForEachEntityChunk

(
    UMassEntitySubsystem& EntitySubsys...,
    FMassExecutionContext& ExecutionCo...,
    const FMassExecuteFunction& Execut...
)

Runs ExecuteFunction on all entities matching Requirements

Public function

void

 

ForEachEntityChunk

(
    const FArchetypeChunkCollection& C...,
    UMassEntitySubsystem& EntitySubsys...,
    FMassExecutionContext& ExecutionCo...,
    const FMassExecuteFunction& Execut...
)

Will first verify that the archetype given with Chunks matches the query's requirements, and if so will run the other, more generic ForEachEntityChunk implementation

Public function Const

const TArray...

 

GetArchetypes()

Public function

int32

 

GetNumMatchingEntities

(
    UMassEntitySubsystem& InEntitySubs...
)

Goes through ValidArchetypes and sums up the number of entities contained in them.

Public function Const

const FMassC...

 

GetRequiredAllChunkFragments()

Public function Const

const FMassF...

 

GetRequiredAllFragments()

Public function Const

const FMassS...

 

GetRequiredAllSharedFragments()

Public function Const

const FMassT...

 

GetRequiredAllTags()

Public function Const

const FMassF...

 

GetRequiredAnyFragments()

Public function Const

const FMassT...

 

GetRequiredAnyTags()

Public function Const

const FMassC...

 

GetRequiredNoneChunkFragments()

Public function Const

const FMassF...

 

GetRequiredNoneFragments()

Public function Const

const FMassS...

 

GetRequiredNoneSharedFragments()

Public function Const

const FMassT...

 

GetRequiredNoneTags()

Public function Const

const FMassC...

 

GetRequiredOptionalChunkFragments()

Public function Const

const FMassF...

 

GetRequiredOptionalFragments()

Public function Const

const FMassS...

 

GetRequiredOptionalSharedFragments()

Public function Const

TConstArrayV...

 

GetRequirements()

Public function Const

bool

 

HasArchetypeFilter()

Public function Const

bool

 

HasChunkFilter()

Public function

bool

 

HasMatchingEntities

(
    UMassEntitySubsystem& InEntitySubs...
)

Checks if any of ValidArchetypes has any entities.

Public function

void

 

ParallelForEachEntityChunk

(
    UMassEntitySubsystem& EntitySubsys...,
    FMassExecutionContext& ExecutionCo...,
    const FMassExecuteFunction& Execut...
)

Attempts to process every chunk of every affected archetype in parallel.

Protected function

void

 

ReadCommandlineParams()

Public function

void

 

SetArchetypeFilter

(
    const FMassArchetypeConditionFuncti...
)

Sets a archetype filter condition that will applied to each valid archetypes.

Public function

void

 

SetChunkFilter

(
    const FMassChunkConditionFunction&...
)

Sets a chunk filter condition that will applied to each chunk of all valid archetypes.

Protected function

void

 

SortRequirements()