Navigation
API > API/Runtime > API/Runtime/MassEntity
Wrapper for const and non-const shared fragment containers that tracks which struct types it holds (via a FMassSharedFragmentBitSet). Note that having multiple instances of a given struct type is not supported and Add* functions will fetch the previously added fragment instead of adding a new one.
Shared fragment TYPES contribute to archetype composition (two archetypes with different shared fragment type sets are distinct). Shared fragment VALUES are stored per-chunk — entities within the same archetype but with different shared values are placed in separate chunks. Chunk selection uses IsEquivalent() which compares by pointer identity (hash of backing struct memory addresses). When shared fragments are obtained via GetOrCreateConstSharedFragment/GetOrCreateSharedFragment, identical values are deduplicated (same pointer), so IsEquivalent effectively acts as value comparison in the expected usage path.
| Name | FMassArchetypeSharedFragmentValues |
| Type | struct |
| Header File | /Engine/Source/Runtime/MassEntity/Public/MassEntityTypes.h |
| Include Path | #include "MassEntityTypes.h" |
Syntax
struct FMassArchetypeSharedFragmentValues
Constructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
| MassEntityTypes.h | |||
FMassArchetypeSharedFragmentValues
(
const FMassArchetypeSharedFragmentValues& Other |
MassEntityTypes.h | ||
| MassEntityTypes.h |
Variables
Protected
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| HashLock | FTransactionallySafeRWLock | MassEntityTypes.h |
Functions
Public
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
void Add
(
const FConstSharedStruct& Fragment |
Adds Fragment to the collection. | MassEntityTypes.h | |
void Add
(
const FSharedStruct& Fragment |
Adds Fragment to the collection. | MassEntityTypes.h | |
FSharedStruct Add_GetRef
(
const FSharedStruct& Fragment |
Adds Fragment to the collection. | MassEntityTypes.h | |
FConstSharedStruct Add_GetRef
(
const FConstSharedStruct& Fragment |
Adds Fragment to the collection. | MassEntityTypes.h | |
FConstSharedStruct AddConstSharedFragment
(
const FConstSharedStruct& Fragment |
MassEntityTypes.h | ||
FSharedStruct AddSharedFragment
(
const FSharedStruct& Fragment |
MassEntityTypes.h | ||
int32 Append
(
const FMassArchetypeSharedFragmentValues& Other |
Appends contents of Other to `this_ instance. | MassEntityTypes.h | |
uint32 CacheHash() |
Returns the cached-or-calculated hash | MassEntityTypes.h | |
uint32 CalculateHash() |
MassEntityTypes.h | ||
bool ContainsType
(
const UScriptStruct* FragmentType |
MassEntityTypes.h | ||
bool ContainsType () |
MassEntityTypes.h | ||
void DirtyHashCache() |
MassEntityTypes.h | ||
bool DoesMatchComposition
(
const FMassArchetypeCompositionDescriptor& InDescriptor |
MassEntityTypes.h | ||
bool DoesMatchComposition
(
const FMassElementBitSet& CompositionBitSet |
MassEntityTypes.h | ||
SIZE_T GetAllocatedSize() |
MassEntityTypes.h | ||
const FMassElementBitSet & GetBitSet() |
MassEntityTypes.h | ||
FMassConstSharedFragmentBitSet GetConstSharedFragmentBitSet() |
MassEntityTypes.h | ||
const TArray< FConstSharedStruct > & GetConstSharedFragments() |
MassEntityTypes.h | ||
FConstSharedStruct GetConstSharedFragmentStruct
(
const UScriptStruct* StructType |
MassEntityTypes.h | ||
| MassEntityTypes.h | |||
| MassEntityTypes.h | |||
| Depending on TSharedStruct returns Shared or ConstShared fragment container | MassEntityTypes.h | ||
TArray< FSharedStruct > & GetMutableSharedFragments() |
MassEntityTypes.h | ||
FMassSharedFragmentBitSet GetSharedFragmentBitSet() |
MassEntityTypes.h | ||
const TArray< FSharedStruct > & GetSharedFragments() |
MassEntityTypes.h | ||
FSharedStruct GetSharedFragmentStruct
(
const UScriptStruct* StructType |
MassEntityTypes.h | ||
FConstSharedStruct GetSharedFragmentStruct
(
const UScriptStruct* StructType |
MassEntityTypes.h | ||
bool HasSameValues
(
const FMassArchetypeSharedFragmentValues& Other |
Compares contents of `this_ and the Other, and allows different order of elements in both containers. | MassEntityTypes.h | |
bool IsEmpty() |
MassEntityTypes.h | ||
bool IsEquivalent
(
const FMassArchetypeSharedFragmentValues& OtherSharedFragmentValues |
MassEntityTypes.h | ||
bool IsSorted() |
MassEntityTypes.h | ||
int32 Remove
(
const FMassConstSharedFragmentBitSet& ConstSharedFragmentToRemoveBitSet |
Note that the function removes the const shared fragments by type | MassEntityTypes.h | |
int32 Remove
(
const FMassSharedFragmentBitSet& SharedFragmentToRemoveBitSet |
Note that the function removes the shared fragments by type | MassEntityTypes.h | |
int32 Remove
(
const FMassElementBitSet& ElementBitSet |
MassEntityTypes.h | ||
int32 Remove
(
const FMassArchetypeSharedFragmentValues& Other |
MassEntityTypes.h | ||
int32 Remove
(
const FMassArchetypeCompositionDescriptor& InDescriptor |
Remove all the shared and const shared fragments indicated by InDescriptor | MassEntityTypes.h | |
void ReplaceSharedFragments
(
TArrayView< TSharedStruct > Fragments |
Finds instances of fragment types given by Fragments and replaces their values with contents of respective element of Fragments. | MassEntityTypes.h | |
void Reset() |
MassEntityTypes.h | ||
void Sort() |
MassEntityTypes.h |
Static
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
static FMassArchetypeSharedFragmentValues CreateCombined
(
const FMassArchetypeSharedFragmentValues& Original, |
MassEntityTypes.h |
Operators
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
FMassArchetypeSharedFragmentValues & operator=
(
const FMassArchetypeSharedFragmentValues& Other |
MassEntityTypes.h | ||
| MassEntityTypes.h |