Navigation
API > API/Runtime > API/Runtime/MassEntity
Adds fragments with initial values to entities. Each entity receives typed fragment data. Tags (FMassTag, FMassSparseTag) are also accepted — they participate in the composition change but are excluded from the value payload (tags have zero-size storage). Uses PushCommand for cross-chunk batching. Sparse fragments are supported (handled internally). All entities are accumulated in a single flat batch and dispatched in one BatchAddFragmentInstancesForEntities call.
When to use: when you need to add fragments AND set their initial values in one operation, optionally adding tags in the same entity move. For composition-only changes (no values), prefer FMassCommandAddElements
Example: // Add fragments with values + tags in a single entity move: Context.Defer().PushCommand
Supported types: FMassFragment + FMassTag (including sparse). Tag instances are accepted by Add() for uniform syntax but their values are ignored. Breakpoint support: Yes — CheckFragmentAddBreakpoints called at PushCommand time.
| Name | FMassCommandAddFragmentInstances |
| Type | struct |
| Header File | /Engine/Source/Runtime/MassEntity/Public/MassCommands.h |
| Include Path | #include "MassCommands.h" |
Syntax
template<typename... TOthers>
struct FMassCommandAddFragmentInstances : public FMassBatchedEntityCommand
Inheritance Hierarchy
- FMassBatchedCommand → FMassBatchedEntityCommand → FMassCommandAddFragmentInstances
Derived Classes
Constructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
FMassCommandAddFragmentInstances
(
EMassCommandOperationType OperationType |
MassCommands.h |
Typedefs
| Name | Type | Remarks | Include Path |
|---|---|---|---|
| Super | FMassBatchedEntityCommand | Note: sparse fragments and sparse tags are intentionally allowed in TOthers. | MassCommands.h |
Functions
Public
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
void Add
(
FMassEntityHandle Entity, |
MassCommands.h |
Protected Virtual
Overridden from FMassBatchedCommand
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual SIZE_T GetAllocatedSize() |
MassCommands.h | ||
virtual void Reset() |
MassCommands.h | ||
virtual void Run
(
FMassEntityManager& EntityManager |
MassCommands.h |