Navigation
API > API/Runtime > API/Runtime/MassEntity
Adds any mix of non-shared element types to entities at runtime. Element types are provided as UScriptStruct* at construction time. Requires PushUniqueCommand — each call creates a separate command instance (no cross-call batching, but entities batch within a single instance via Add()). Performs a single entity move for all non-sparse types + in-place sparse addition.
When to use: when element types are only known at runtime and you need to add multiple types at once. Prefer FMassCommandAddElements
Example: const UScriptStruct* Types[] = { FMyFragment::StaticStruct(), FMyTag::StaticStruct() }; // Single entity: FMassCommandAddElementList& Cmd = Context.Defer().PushUniqueCommand
Supported types: FMassFragment, FMassTag, FMassSparseFragment, FMassSparseTag. Rejected types: shared/const shared and chunk fragments are rejected at runtime by BatchChangeCompositionForEntities (no compile-time check). Breakpoint support: No (runtime types).
| Name | FMassCommandAddElementList |
| Type | struct |
| Header File | /Engine/Source/Runtime/MassEntity/Public/MassCommands.h |
| Include Path | #include "MassCommands.h" |
Syntax
struct FMassCommandAddElementList : public FMassBatchedEntityCommand
Inheritance Hierarchy
- FMassBatchedCommand → FMassBatchedEntityCommand → FMassCommandAddElementList
Constructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
FMassCommandAddElementList
(
TConstArrayView< const UScriptStruct* > InElementTypes |
MassCommands.h |
Typedefs
| Name | Type | Remarks | Include Path |
|---|---|---|---|
| Super | FMassBatchedEntityCommand | MassCommands.h |
Functions
Public
Protected Virtual
Overridden from FMassBatchedCommand
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual SIZE_T GetAllocatedSize() |
MassCommands.h | ||
virtual void Run
(
FMassEntityManager& EntityManager |
MassCommands.h |