UActorComponent::AllowsAsyncPhysicsStateCreation
#include "Components/ActorComponent.h"
Access: public
Specifiers: virtual
Description
Override to return true to allow this component's physics state to be created on a background physics thread instead of the game thread. Part of the IAsyncPhysicsStateProcessor interface.
Caveats & Gotchas
- • Returning true here only opts the component in as a candidate; async creation is still gated by CreatePhysicsState being called with bAllowDeferral = true AND the physics scene supporting async jobs.
- • If you return true, you must also implement OnAsyncCreatePhysicsState correctly; the engine will call it from a non-game-thread context, so all work inside must be thread-safe.
Signature
virtual bool AllowsAsyncPhysicsStateCreation() const
{
return false;
} Return Type
bool Example
Opting a heavy physics component into async creation C++
bool UMyComplexPhysicsComponent::AllowsAsyncPhysicsStateCreation() const
{
// Only async-create when the mesh asset is loaded and complex enough to justify it
return StaticMesh && StaticMesh->GetBodySetup() && StaticMesh->GetBodySetup()->AggGeom.ConvexElems.Num() > 32;
} See Also
Tags
Version History
Introduced in: unknown
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?