UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
FMassCommandBuffer Struct Reference

#include <MassCommandBuffer.h>

Public Member Functions

MASSENTITY_API FMassCommandBuffer ()
 
MASSENTITY_API ~FMassCommandBuffer ()
 
template<template< typename... TArgs > typename TCommand, typename... TArgs>
void PushCommand (const FMassEntityHandle Entity, TArgs &&... InArgs)
 
template<typename TCommand , typename... TArgs>
void PushCommand (TArgs &&... InArgs)
 
template<typename TCommand >
void PushCommand (const FMassEntityHandle Entity)
 
template<typename TCommand >
void PushCommand (TConstArrayView< FMassEntityHandle > Entities)
 
void PushUniqueCommand (TUniquePtr< FMassBatchedCommand > &&CommandInstance)
 
template<typename T >
void AddFragment (FMassEntityHandle Entity)
 
template<typename T >
void AddFragment_RuntimeCheck (FMassEntityHandle Entity)
 
template<typename T >
void RemoveFragment (FMassEntityHandle Entity)
 
template<typename T >
void RemoveFragment_RuntimeCheck (FMassEntityHandle Entity)
 
template<typename T >
void AddTag (FMassEntityHandle Entity)
 
template<typename T >
void AddTag (TConstArrayView< FMassEntityHandle > Entities)
 
template<typename T >
void AddTag_RuntimeCheck (FMassEntityHandle Entity)
 
template<typename T >
void RemoveTag (FMassEntityHandle Entity)
 
template<typename T >
void RemoveTag (TConstArrayView< FMassEntityHandle > Entities)
 
template<typename T >
void RemoveTag_RuntimeCheck (FMassEntityHandle Entity)
 
template<typename TOld , typename TNew >
void SwapTags (FMassEntityHandle Entity)
 
template<typename TOld , typename TNew >
void SwapTags_RuntimeCheck (FMassEntityHandle Entity)
 
void DestroyEntity (FMassEntityHandle Entity)
 
void DestroyEntities (TConstArrayView< FMassEntityHandle > InEntitiesToDestroy)
 
void DestroyEntities (TArray< FMassEntityHandle > &&InEntitiesToDestroy)
 
MASSENTITY_API SIZE_T GetAllocatedSize () const
 
MASSENTITY_API void MoveAppend (FMassCommandBuffer &InOutOther)
 
bool HasPendingCommands () const
 
bool IsFlushing () const
 
void CancelCommands ()
 
bool IsInOwnerThread () const
 
void ForceUpdateCurrentThreadID ()
 

Constructor & Destructor Documentation

◆ FMassCommandBuffer()

FMassCommandBuffer::FMassCommandBuffer ( )

◆ ~FMassCommandBuffer()

FMassCommandBuffer::~FMassCommandBuffer ( )

Member Function Documentation

◆ AddFragment()

template<typename T >
void FMassCommandBuffer::AddFragment ( FMassEntityHandle  Entity)
inline

◆ AddFragment_RuntimeCheck()

template<typename T >
void FMassCommandBuffer::AddFragment_RuntimeCheck ( FMassEntityHandle  Entity)
inline

◆ AddTag() [1/2]

template<typename T >
void FMassCommandBuffer::AddTag ( FMassEntityHandle  Entity)
inline

the convenience function equivalent to calling PushCommand<FMassCommandAddTag<T>>(Entity)

◆ AddTag() [2/2]

template<typename T >
void FMassCommandBuffer::AddTag ( TConstArrayView< FMassEntityHandle Entities)
inline

◆ AddTag_RuntimeCheck()

template<typename T >
void FMassCommandBuffer::AddTag_RuntimeCheck ( FMassEntityHandle  Entity)
inline

◆ CancelCommands()

void FMassCommandBuffer::CancelCommands ( )
inline

Removes any pending command instances This could be required for CommandBuffers that are queued to flush their commands on the game thread but the EntityManager is no longer available. In such scenario we need to cancel commands to avoid an ensure for unprocessed commands when the buffer gets destroyed.

◆ DestroyEntities() [1/2]

void FMassCommandBuffer::DestroyEntities ( TArray< FMassEntityHandle > &&  InEntitiesToDestroy)
inline

◆ DestroyEntities() [2/2]

void FMassCommandBuffer::DestroyEntities ( TConstArrayView< FMassEntityHandle InEntitiesToDestroy)
inline

◆ DestroyEntity()

void FMassCommandBuffer::DestroyEntity ( FMassEntityHandle  Entity)
inline

◆ ForceUpdateCurrentThreadID()

void FMassCommandBuffer::ForceUpdateCurrentThreadID ( )

Updates the OwnerThreadId which indicates that the given command buffer instance is being used in a different thread now. Use this with extreme caution, it's not a tool to be used every time we get "Commands can be pushed only in the same thread where the command buffer was created." error. It's meant to be used when there's a possibility the code owning the buffer has been moved to another thread (like in ParallelFor).

◆ GetAllocatedSize()

SIZE_T FMassCommandBuffer::GetAllocatedSize ( ) const

◆ HasPendingCommands()

bool FMassCommandBuffer::HasPendingCommands ( ) const
inline

◆ IsFlushing()

bool FMassCommandBuffer::IsFlushing ( ) const
inline

◆ IsInOwnerThread()

bool FMassCommandBuffer::IsInOwnerThread ( ) const
inline

◆ MoveAppend()

void FMassCommandBuffer::MoveAppend ( FMassCommandBuffer InOutOther)

Appends the commands from the passed buffer into this one

Parameters
InOutOtherthe source buffer to copy the commands from. Note that after the call the InOutOther will be emptied due to the function using Move semantics

◆ PushCommand() [1/4]

template<typename TCommand >
void FMassCommandBuffer::PushCommand ( const FMassEntityHandle  Entity)
inline

Adds a new entry to a given TCommand batch command instance

◆ PushCommand() [2/4]

template<template< typename... TArgs > typename TCommand, typename... TArgs>
void FMassCommandBuffer::PushCommand ( const FMassEntityHandle  Entity,
TArgs &&...  InArgs 
)
inline

Adds a new entry to a given TCommand batch command instance

◆ PushCommand() [3/4]

template<typename TCommand , typename... TArgs>
void FMassCommandBuffer::PushCommand ( TArgs &&...  InArgs)
inline

◆ PushCommand() [4/4]

template<typename TCommand >
void FMassCommandBuffer::PushCommand ( TConstArrayView< FMassEntityHandle Entities)
inline

◆ PushUniqueCommand()

void FMassCommandBuffer::PushUniqueCommand ( TUniquePtr< FMassBatchedCommand > &&  CommandInstance)
inline

Ordinary PushCommand calls try to reuse existing command instances (as stored in CommandInstances) based on their type. This command lets callers add a manually configured command instance, that might not be distinguishable from other commands based solely on its type. For example, when you implement a command type that has member properties that control how the given command works or what exactly it does.

◆ RemoveFragment()

template<typename T >
void FMassCommandBuffer::RemoveFragment ( FMassEntityHandle  Entity)
inline

◆ RemoveFragment_RuntimeCheck()

template<typename T >
void FMassCommandBuffer::RemoveFragment_RuntimeCheck ( FMassEntityHandle  Entity)
inline

◆ RemoveTag() [1/2]

template<typename T >
void FMassCommandBuffer::RemoveTag ( FMassEntityHandle  Entity)
inline

the convenience function equivalent to calling PushCommand<FMassCommandRemoveTag<T>>(Entity)

◆ RemoveTag() [2/2]

template<typename T >
void FMassCommandBuffer::RemoveTag ( TConstArrayView< FMassEntityHandle Entities)
inline

◆ RemoveTag_RuntimeCheck()

template<typename T >
void FMassCommandBuffer::RemoveTag_RuntimeCheck ( FMassEntityHandle  Entity)
inline

◆ SwapTags()

template<typename TOld , typename TNew >
void FMassCommandBuffer::SwapTags ( FMassEntityHandle  Entity)
inline

the convenience function equivalent to calling PushCommand<FMassCommandSwapTags<TOld, TNew>>(Entity)

◆ SwapTags_RuntimeCheck()

template<typename TOld , typename TNew >
void FMassCommandBuffer::SwapTags_RuntimeCheck ( FMassEntityHandle  Entity)
inline

The documentation for this struct was generated from the following files: