UAnimInstance::GetWorld
#include "Animation/AnimInstance.h"
Access: public
Specifiers: virtualoverrideconst
Description
Returns the UWorld the anim instance belongs to, derived from its owning skeletal mesh component's outer chain.
Caveats & Gotchas
- • Returns nullptr for an anim instance that isn't currently attached to a component in a live world, such as one used purely for asset preview/editor purposes.
- • Overridden from UObject::GetWorld specifically because an anim instance's outer is the skeletal mesh component, not an actor, so the default UObject implementation wouldn't find the world correctly.
Signature
virtual UWorld* GetWorld() const override Return Type
UWorld* Example
Get the world from within an anim instance method C++
void UMyAnimInstance::NativeUpdateAnimation(float DeltaSeconds)
{
if (UWorld* World = GetWorld())
{
DeltaTimeAccum += World->GetDeltaSeconds();
}
} Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?