Description

UGeometryCollectionComponent::EventDispatcher gets registered for events twice, once in UGeometryCollectionComponent::RegisterForEvents() and again in UChaosGameplayEventDispatcher::OnRegister(). That can result in duplicate collision events being fired. DispatchConsumerData() takes different paths depending on whether there are more things listening for hit events than the total number of hit events, and the bug only exists in the path with more listeners, so it's required to have more BPs in the scene.

Steps to Reproduce

Repro steps:
1. Create a geometry collection from a simple shape, no need to fracture it
2. Enable the geometry collection's Notify Collisions
3. Create a blueprint from the geometry collection and make it print something on Event Hit
4. Make a simple map with at least three instances of the geometry collection and something static below just one instance for it to fall on. This is necessary because there are separate paths in TEventContainer::DispatchConsumerData() depending on whether the number of handlers is greater than the number of events, and the bug only repros in the path where it is.
5. Simulate the map one step at a time and notice that the print happens twice on the first frame of collision.

Might be easier to refer to the last repro project in the case:
1. Open ReproMap2
2. In the logs verify that there can be 2 hits in the same frame for a single object collision ([GC_Cube2_Blueprint_C_1] 0.287047- Hits: 2)

Callstack

Call Stack of DispatchConsumerData for context, non-fatal:
> UnrealEditor-Chaos.dll!Chaos::TEventContainer<Chaos::FTrailingEventData>::DispatchConsumerData() Line 298 C++
UnrealEditor-Chaos.dll!Chaos::FEventManager::DispatchEvents() Line 97 C++
UnrealEditor-PhysicsCore.dll!??$?RVFPBDRigidsSolver@Chaos@@@<lambda_1>@?EB@??EndFrame@FChaosScene@@QEAAXXZ@QEBA?A_PAEAVFPBDRigidsSolver@Chaos@@@Z(Chaos::FPBDRigidsSolver & Concrete) Line 562 C++
[Inline Frame] UnrealEditor-PhysicsCore.dll!Chaos::FPhysicsSolverBase::CastHelper(const FChaosScene::EndFrame::__l65::<lambda_1> &) Line 313 C++
UnrealEditor-PhysicsCore.dll!FChaosScene::EndFrame() Line 554 C++
[Inline Frame] UnrealEditor-Engine.dll!Invoke(void(UWorld::*)()) Line 66 C++
[Inline Frame] UnrealEditor-Engine.dll!UE::Core::Private::Tuple::TTupleBase<TIntegerSequence<unsigned int>>::ApplyAfter(void(UWorld::*)() &) Line 309 C++
UnrealEditor-Engine.dll!V::TBaseUObjectMethodDelegateInstance::ExecuteIfSafe() Line 667 C++
[Inline Frame] UnrealEditor-Engine.dll!TDelegate<void __cdecl(void),FDefaultDelegateUserPolicy>::ExecuteIfBound() Line 570 C++
[Inline Frame] UnrealEditor-Engine.dll!FSimpleDelegateGraphTask::DoTask(ENamedThreads::Type) Line 1580 C++
UnrealEditor-Engine.dll!TGraphTask<FSimpleDelegateGraphTask>::ExecuteTask(TArray<FBaseGraphTask *,TSizedDefaultAllocator<32>> & NewTasks, ENamedThreads::Type CurrentThread, bool bDeleteOnCompletion) Line 1235 C++
[Inline Frame] UnrealEditor-Core.dll!FBaseGraphTask::Execute(TArray<FBaseGraphTask *,TSizedDefaultAllocator<32>> & CurrentThread, ENamedThreads::Type) Line 840 C++
UnrealEditor-Core.dll!FNamedTaskThread::ProcessTasksNamedThread(int QueueIndex, bool bAllowStall) Line 760 C++
UnrealEditor-Core.dll!FNamedTaskThread::ProcessTasksUntilQuit(int QueueIndex) Line 651 C++
[Inline Frame] UnrealEditor-Core.dll!FTaskGraphCompatibilityImplementation::ProcessThreadUntilRequestReturn(ENamedThreads::Type) Line 2068 C++
UnrealEditor-Core.dll!FTaskGraphCompatibilityImplementation::WaitUntilTasksComplete(const TArray<TRefCountPtr<FGraphEvent>,TSizedInlineAllocator<4,32,TSizedDefaultAllocator<32>>> & Tasks, ENamedThreads::Type CurrentThreadIfKnown) Line 2122 C++
UnrealEditor-Engine.dll!FTickTaskSequencer::ReleaseTickGroup(ETickingGroup WorldTickGroup, bool bBlockTillComplete) Line 556 C++

Have Comments or More Details?

There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-224746 in the post.

0
Login to Vote

Unresolved
CreatedSep 18, 2024
UpdatedSep 19, 2024
View Jira Issue