Navigation
API > API/Runtime > API/Runtime/MassEntity
Mass Commands Quick ReferenceADDING ELEMENTS (composition-only, no initial values):
Need
Command
Batching
BP
Add fragments/tags/sparse
FMassCommandAddElements
Cross-chunk
Yes
(compile-time types)
Convenience: AddElements
--
Add fragments/tags/sparse
Per-inst.
No
(runtime types)
Convenience: AddElements(E, T)
--
Add single type (runtime)
Per-inst.
No ADDING FRAGMENTS WITH VALUES (+ optional tags/sparse):
Need
Command
Batching
BP
Add fragments with values
FMassCommandAddFragmentInstances
Cross-chunk
Yes
- optional tags/sparse
T... accepts FMassFragment, FMassTag, and sparse subtypes
Tags/sparse tags: composition only. Sparse frags: in-place
ADDING ELEMENTS WITH SHARED FRAGMENT VALUES (+ optional tags/sparse):
Need
Command
Batching
BP
Add fragments/tags/sparse
FMassCommandAddElementsWithSharedFragments
Per-hash
No
- shared fragment values
Convenience: AddElementsWithSharedFragments
group
--
Add fragments with values
FMassCommandAddFragmentInstancesWithSharedFragments
Per-hash
Yes
- shared values + tags
group
REMOVING ELEMENTS:
Need
Command
Batching
BP
Remove any element types
FMassCommandRemoveElements
Cross-chunk
Yes
(compile-time types)
Convenience: RemoveElements
--
Remove any element types
Per-inst.
No
(runtime types)
Convenience: RemoveElements(E, T)
--
Remove single (runtime)
Per-inst.
No CHANGING COMPOSITION:
Need
Command
Batching
BP
Swap one tag for another
FMassCommandSwapTags
Cross-chunk
No
(compile-time types)
Convenience: SwapTags
CREATING ENTITIES (+ optional tags/sparse):
Need
Command
Batching
BP
Create entity with values
FMassCommandBuildEntity
Cross-chunk
Yes
- optional tags/sparse
T... accepts FMassFragment, FMassTag, and sparse subtypes
--
Create with shared values
FMassCommandBuildEntityWithSharedFragments
Per-hash
Yes
- optional tags/sparse
T... accepts fragments, tags, sparse
group
DESTROYING ENTITIES:
Need
Command
Batching
BP
Destroy entities
Cross-chunk
Yes
Convenience: DestroyEntity/Entities()
DEFERRED (LAMBDA):
Need
Command
Batching
BP
Arbitrary logic at flush
FMassDeferredCreateCommand
Cross-chunk
No
(type depends on op)
FMassDeferredAddCommand
FMassDeferredRemoveCommand
FMassDeferredChangeCompositionCommand
FMassDeferredSetCommand
FMassDeferredDestroyCommand
NOTES:
- Cross-chunk: PushCommand reuses one instance across all chunks; one Run() for all entities.
- Per-inst.: PushUniqueCommand creates a new instance per call. Entities batch via Add().
- Per-hash group: entities grouped by shared fragment value hash; one move per group.
- Adding shared/const shared fragments requires values; use the WithSharedFragments variant.
- Removing shared/const shared fragments is supported by RemoveElements and RemoveElement.
- Sparse elements are handled in-place (no archetype move). Non-sparse types: single entity move.
- BP = Breakpoint support (Mass debugger breakpoints triggered at PushCommand time).
- Deferred commands store a TFunction
; no type safety, full flexibility.
Enum used by MassBatchCommands to declare their "type". This data is later used to group commands so that command effects are applied in a controllable fashion Important: if changed make sure to update FMassCommandBuffer::Flush.CommandTypeOrder as well
| Name | EMassCommandOperationType |
| Type | enum |
| Header File | /Engine/Source/Runtime/MassEntity/Public/MassCommands.h |
| Include Path | #include "MassCommands.h" |
Syntax
enum EMassCommandOperationType
{
None,
Create,
Add,
Remove,
ChangeComposition,
Set,
Destroy,
MAX,
}
Values
| Name | Remarks |
|---|---|
| None | |
| Create | |
| Add | |
| Remove | |
| ChangeComposition | |
| Set | |
| Destroy | Depending on specific command, so this group will always be executed after the Add group |
| MAX |