RealDocs

UActorComponent::OnAsyncDestroyPhysicsStateEnd_GameThread

function Engine Since 5.0
#include "Components/ActorComponent.h"
Access: public Specifiers: virtualoverride

Description

Called on the game thread after async physics state destruction completes. Use this to finalize any cleanup that must happen on the game thread once all async physics work is done.

Caveats & Gotchas

  • Always call Super::OnAsyncDestroyPhysicsStateEnd_GameThread() — the base implementation clears bPhysicsStateCreated and broadcasts destruction events.
  • This is the correct place to release UObject references that were held during async teardown, since those must be released on the game thread.
  • Do not assume the physics body handles are still valid by the time this runs — they may have been freed by the async pass.

Signature

ENGINE_API virtual void OnAsyncDestroyPhysicsStateEnd_GameThread() override;

Return Type

void

Example

Finalize game-thread state after async physics teardown C++
void UMyPhysicsComponent::OnAsyncDestroyPhysicsStateEnd_GameThread()
{
    Super::OnAsyncDestroyPhysicsStateEnd_GameThread();
    // Safe to clear UObject references now that async work is done
    CachedBodySetup = nullptr;
    OnPhysicsDestroyed.Broadcast();
}

Version History

Introduced in: 5.0

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.