UMassAgentSubsystem::HandlePendingInitialization creates a single FEntityCreationContext that is reused across all iterations of the PendingAgentEntities loop. When SpawnEntities eventually calls into FMassEntityManager::BatchSetEntityFragmentValues, the function operates on all entity collections registered with the provided CreationContext. It does not internally filter those collections by archetype or by the EntityTemplate used in the spawning flow, which leads to the warning.
FMassEntityManager::BatchSetEntityFragmentValues may assume that the caller has already constrained the EntityCollections appropriately. Filtering by template or archetype would be both expensive and may go against the batch spawning pipeline.
A reasonable workaround would be to move the creation of the FEntityCreationContext inside the PendingAgentEntities iteration, so that each iteration operates on a fresh context.
1. Create a MassEntityConfigAsset (EntityConfigA), add the AssortedFragments trait and add two different fragments (Fragment1 and Fragment2).
2. Create an Actor (ActorA), add the MassAgentComponent and assign EntityConfigA.
3. Create another MassEntityConfigAsset (EntityConfigB), add the AssortedFragments trait and add two different fragments. One should be the same and the other different from the ones on EntityConfigA (Fragment1 and Fragment3).
4. Create an Actor (ActorB), add the MassAgentComponent and assign EntityConfigB.
5. Place ActorA and ActorB on a level and hit Play.
6. Set a breakpoint on UMassAgentSubsystem::HandlePendingInitialization, and monitorize the callstack UMassSpawnerSubsystem::SpawnEntities -> UMassSpawnerSubsystem::DoSpawning -> FMassEntityManager::BatchSetEntityFragmentValues -> FMassArchetypeData::SetFragmentData
7. On the second iteration of the loop, you should observe that Fragment1 on the Entity of type "A" resets to its initial values, and when Fragment3 is processed, the FindCheck will be triggered (without CL 45139186) or a Warning "Attempting to set value of fragment of type MassEntityAgentFragment, while it's not part of the archetype's composition" will be logged (with CL 45139186).
> UnrealEditor-MassEntity.dll!FMassArchetypeData::SetFragmentData<FInstancedStruct>(TArrayView<FMassArchetypeEntityCollection::FArchetypeEntityRange const ,int> EntityRangeContainer, const FInstancedStruct & FragmentSource) Line 617 C++
UnrealEditor-MassEntity.dll!FMassEntityManager::BatchSetEntityFragmentValues<FInstancedStruct>(TArrayView<FMassArchetypeEntityCollection const ,int> EntityCollections, TArrayView<FInstancedStruct const ,int> FragmentInstanceList) Line 1842 C++
[Inline Frame] UnrealEditor-MassSpawner.dll!FMassEntityManager::BatchSetEntityFragmentValues(TArrayView<FMassArchetypeEntityCollection const ,int>) Line 1505 C++
UnrealEditor-MassSpawner.dll!UMassSpawnerSubsystem::DoSpawning(const FMassEntityTemplate & EntityTemplate, const int NumToSpawn, FConstStructView SpawnData, TSubclassOf<UMassProcessor> InitializerClass, TArray<FMassEntityHandle,TSizedDefaultAllocator<32>> & OutEntities) Line 141 C++
UnrealEditor-MassSpawner.dll!UMassSpawnerSubsystem::SpawnEntities(const FMassEntityTemplate & EntityTemplate, const unsigned int NumberToSpawn, TArray<FMassEntityHandle,TSizedDefaultAllocator<32>> & OutEntities) Line 65 C++
UnrealEditor-MassActors.dll!UMassAgentSubsystem::HandlePendingInitialization() Line 330 C++
[External Code]
UnrealEditor-MassEntity.dll!FMassProcessingPhase::ExecuteTick(float DeltaTime, ELevelTick TickType, ENamedThreads::Type CurrentThread, const TRefCountPtr<FBaseGraphTask> & MyCompletionGraphEvent) Line 75 C++
[Inline Frame] UnrealEditor-Engine.dll!FTickFunctionTask::DoTask(ENamedThreads::Type CurrentThread, const TRefCountPtr<FBaseGraphTask> &) Line 334 C++
UnrealEditor-Engine.dll!TGraphTask<FTickFunctionTask>::ExecuteTask() Line 710 C++
UnrealEditor-Core.dll!UE::Tasks::Private::FTaskBase::TryExecuteTask() Line 518 C++
[Inline Frame] UnrealEditor-Core.dll!FBaseGraphTask::Execute(TArray<FBaseGraphTask *,TSizedDefaultAllocator<32>> &) Line 493 C++
UnrealEditor-Core.dll!FNamedTaskThread::ProcessTasksNamedThread(int QueueIndex, bool bAllowStall) Line 799 C++
UnrealEditor-Core.dll!FNamedTaskThread::ProcessTasksUntilIdle(int QueueIndex) Line 699 C++
[Inline Frame] UnrealEditor-Core.dll!FTaskGraphCompatibilityImplementation::ProcessThreadUntilIdle(ENamedThreads::Type) Line 1439 C++
UnrealEditor-Core.dll!FTaskGraphCompatibilityImplementation::ProcessUntilTasksComplete(const TArray<TRefCountPtr<FBaseGraphTask>,TSizedInlineAllocator<4,32,TSizedDefaultAllocator<32>>> & Tasks, ENamedThreads::Type CurrentThreadIfKnown, const TFunction<enum FTaskGraphInterface::EProcessTasksOperation __cdecl(int)> & IdleWorkUpdate) Line 1612 C++
UnrealEditor-Engine.dll!FTickTaskSequencer::ReleaseTickGroup(ETickingGroup WorldTickGroup, bool bBlockTillComplete, TArray<FTickFunction *,TSizedDefaultAllocator<32>> & TicksToManualDispatch) Line 1040 C++
UnrealEditor-Engine.dll!FTickTaskManager::RunTickGroup(ETickingGroup Group, bool bBlockTillComplete) Line 2134 C++
[Inline Frame] UnrealEditor-Engine.dll!UWorld::RunTickGroup(ETickingGroup) Line 784 C++
UnrealEditor-Engine.dll!UWorld::Tick(ELevelTick TickType, float DeltaSeconds) Line 1721 C++
UnrealEditor-UnrealEd.dll!UEditorEngine::Tick(float DeltaSeconds, bool bIdleMode) Line 2174 C++
UnrealEditor-UnrealEd.dll!UUnrealEdEngine::Tick(float DeltaSeconds, bool bIdleMode) Line 534 C++
UnrealEditor.exe!FEngineLoop::Tick() Line 5838 C++
There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-363495 in the post.
| 0 |
| Component | UE - AI - Mass |
|---|---|
| Affects Versions | 5.6, 5.7 |
| Created | Feb 3, 2026 |
|---|---|
| Updated | Feb 3, 2026 |