Navigation
API > API/Runtime > API/Runtime/MassEntity
Adds a single element type (fragment, tag, or sparse) to entities at runtime. Requires PushUniqueCommand — each call creates a separate command instance (no cross-call batching). Shared/const shared fragments are rejected at runtime (they require values).
When to use: when the element type is only known at runtime and you need to add a single type. Prefer FMassCommandAddElements
Example: // Single entity: FMassCommandAddElement& Cmd = Context.Defer().PushUniqueCommand
Supported types: FMassFragment, FMassTag, FMassSparseFragment, FMassSparseTag. Rejected types: FMassSharedFragment, FMassConstSharedFragment, FMassChunkFragment. Breakpoint support: No (runtime types — use FMassCommandAddElements
| Name | FMassCommandAddElement |
| Type | struct |
| Header File | /Engine/Source/Runtime/MassEntity/Public/MassCommands.h |
| Include Path | #include "MassCommands.h" |
Syntax
struct FMassCommandAddElement : public FMassBatchedEntityCommand
Inheritance Hierarchy
- FMassBatchedCommand → FMassBatchedEntityCommand → FMassCommandAddElement
Constructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
FMassCommandAddElement
(
const TNotNull< const UScriptStruct* > InElementType |
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 void Run
(
FMassEntityManager& EntityManager |
MassCommands.h |