UActorComponent::OnAsyncCreatePhysicsState
#include "Components/ActorComponent.h"
Access: public
Specifiers: virtualoverride
Description
Called on a background physics thread to perform the actual async physics state creation work. Override to build physics bodies incrementally, returning false if the timeout expires before completion.
Caveats & Gotchas
- • This executes off the game thread — you must not access any UObject members or engine subsystems that are not thread-safe. Use only Chaos/PhysX primitives and pre-fetched data captured before this call.
- • Returning false signals that work is incomplete and the job should be resumed next frame; returning true signals success and triggers a call to OnAsyncCreatePhysicsStateEnd_GameThread on the game thread.
Signature
ENGINE_API virtual bool OnAsyncCreatePhysicsState(const UE::FTimeout& Timeout) override; Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| Timeout | const UE::FTimeout& | A deadline object; return false when the timeout expires so the job can be rescheduled next frame. | — |
Return Type
bool Example
Incremental async physics body construction C++
bool UMyBulkPhysicsComponent::OnAsyncCreatePhysicsState(const UE::FTimeout& Timeout)
{
while (PendingBodies.Num() > 0)
{
if (Timeout.IsExpired())
{
return false; // continue next frame
}
CreateNextPhysicsBody(PendingBodies.Pop());
}
return true; // all bodies created
} See Also
Tags
Version History
Introduced in: unknown
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?