RealDocs

UActorComponent::OnAsyncDestroyPhysicsState

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

Description

Called asynchronously to destroy the physics state for this component. The base implementation returns true immediately, indicating destruction is complete. Override in subclasses that need async teardown work.

Caveats & Gotchas

  • Return false to indicate teardown is not yet complete — the engine will call this again next frame until it returns true or the timeout expires.
  • This runs off the game thread; do not access UObjects or engine subsystems without proper synchronization.
  • The companion Begin/End_GameThread callbacks handle any game-thread setup or cleanup around this async operation.

Signature

virtual bool OnAsyncDestroyPhysicsState(const UE::FTimeout& Timeout) override { return true; }

Parameters

Name Type Description Default
Timeout const UE::FTimeout& Timeout handle used to detect if the async operation has exceeded its allotted time.

Return Type

bool

Example

Async physics state destruction with timeout check C++
bool UMyComponent::OnAsyncDestroyPhysicsState(const UE::FTimeout& Timeout)
{
    // Signal our physics body for async removal
    if (PhysicsHandle)
    {
        PhysicsHandle->RequestDestroy();
        if (PhysicsHandle->IsDestroyComplete())
        {
            PhysicsHandle = nullptr;
            return true; // done
        }
        return false; // still in progress
    }
    return true;
}

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.