![]() |
UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
|
#include <MassEntityCollection.h>
Type represents a collection of arbitrary EntityHandles. Under the hood the type stores also an array of FMassArchetypeEntityCollection instances. These cached collections can be tested for being up to date, and re-created on demand, based on stored entity handles.
The type is intended to be used to collect entities available through different means: individual handles, handle arrays and or FMassArchetypeEntityCollection instances. Such accumulated handles can at any moment be turned into an array of up-to-date FMassArchetypeEntityCollection instance, which in turn is how entity sets are provided to MassEntityManager's batched API.
The biggest win while using this type is that the user doesn't have to worry about FMassArchetypeEntityCollection instances going out of date (which happens whenever the target archetype is touched in a way that changes internal entity indices). The type automatically updates the collections and caches the result.
|
default |
|
explicit |
The following constructor are equivalent to using the default constructor and subsequently calling AppendCollection or AppendHandles.
|
explicit |
|
explicit |
| UE::Mass::FEntityCollection::FEntityCollection | ( | const TConstArrayView< FMassEntityHandle > | InEntityHandles, |
| FMassArchetypeEntityCollection && | InEntityCollection | ||
| ) |
| void UE::Mass::FEntityCollection::AddHandle | ( | FMassEntityHandle | Handle | ) |
Appends the Handle to stored EntityHandles. Results in marking cached FMassArchetypeEntityCollection as dirty.
|
inline |
Based on the provided FMassArchetypeEntityCollection creates an array of entity handles and stores them. If up to this point the cached FMassArchetypeEntityCollection-s are consistent with stored EntityHandles then InEntityCollection gets stored as well, and stored collections are not marked as dirty.
| void UE::Mass::FEntityCollection::AppendHandles | ( | TArray< FMassEntityHandle > && | Handles | ) |
Appends Handles to stored EntityHandles. Results in marking cached FMassArchetypeEntityCollection as dirty.
| void UE::Mass::FEntityCollection::AppendHandles | ( | TConstArrayView< FMassEntityHandle > | Handles | ) |
Appends Handles to stored EntityHandles. Results in marking cached FMassArchetypeEntityCollection as dirty.
| void UE::Mass::FEntityCollection::AppendHandles | ( | TConstArrayView< FMassEntityHandle > | Handles, |
| FMassArchetypeEntityCollection && | InEntityCollection | ||
| ) |
Appends Handles to stored EntityHandles. The second parameter is relevant if, at the moment of calling, the cached FMassArchetypeEntityCollection instances are in sync with stored entity handles (meaning all entities stored in EntityHandles are also captured by one of FMassArchetypeEntityCollection). If that's the case then the InEntityCollection gets stored along with existing collections. Otherwise, InEntityCollection will be ignored.
|
inline |
Updates cached archetype collections and returns the container with move semantics
|
inline |
Retrieves the view to current contents of CachedCollections, which may be out of date. If you need valid, up-to-date collections call GetUpToDatePerArchetypeCollections instead.
|
inline |
|
inline |
Fetches up-to-date FMassArchetypeEntityCollection instances matching stored entity handles.
|
inline |
| bool UE::Mass::FEntityCollection::IsUpToDate | ( | ) | const |
Checks if cached collection data is up to date If CachedCollections are not up-to-date we reset them to cache the information (and make the subsequent tests cheaper) Note that, depending on the contents, the test might be non-trivial. Use responsibly.
|
inline |
| bool UE::Mass::FEntityCollection::UpdateAndRemoveDuplicates | ( | const FMassEntityManager & | EntityManager, |
| bool | bForceOperation = false |
||
| ) |
Results in duplicate handles being removed from EntityHandles, the cached collections being up-to-date and CollectionCreationDuplicatesHandling being set to FMassArchetypeEntityCollection::NoDuplicates
| bForceOperation | by default the entity handles will be re-exported only if CollectionCreationDuplicatesHandling == FMassArchetypeEntityCollection::FoldDuplicates (which means we cannot rule out that there are duplicates). Using bForceOperation = true will perform the operation regardless. |