UWorld DestroyActor时候,就会直接调用
Engine\Source\Runtime\Engine\Private\Components\PrimitiveComponent.cpp
void UPrimitiveComponent::DestroyRenderState_Concurrent()
{
// Remove the primitive from the scene.
if(World && World->Scene)
{
World->Scene->RemovePrimitive(this);
}
Super::DestroyRenderState_Concurrent();
}
RemovePrimitive这个函数调用是发送了一个remove消息进入渲染线程队列。
然后GC在删除OBJECT时候,调用begindestroy
void UPrimitiveComponent::BeginDestroy()
{
Super::BeginDestroy();
// Use a fence to keep track of when the rendering thread executes this scene detachment.
DetachFence.BeginFence();
AActor* Owner = GetOwner();
if(Owner)
{
Owner->DetachFence.BeginFence();
}
}