RealDocs

UAnimInstance::GetSubsystem

function Engine Since 5.0
#include "Animation/AnimInstance.h"
Access: public Specifiers: const

Description

Retrieves an animation subsystem of the specified type from this anim instance. Use this when you expect the subsystem to be present — it provides direct access to registered animation subsystems that extend the anim instance with modular functionality.

Caveats & Gotchas

  • Unlike FindSubsystem, this function expects the subsystem to exist. If the subsystem has not been registered, behavior depends on the engine version — it may return nullptr or assert. Use FindSubsystem for optional lookups.
  • Animation subsystems are created during anim instance initialization. Calling GetSubsystem before initialization completes (e.g., in the constructor) will not find any subsystems.

Signature

template <typename TSubsystemClass> TSubsystemClass* GetSubsystem() const

Return Type

TSubsystemClass*

Example

Access a required animation subsystem C++
void UMyAnimInstance::NativeUpdateAnimation(float DeltaSeconds)
{
    Super::NativeUpdateAnimation(DeltaSeconds);
    
    // Access the locomotion subsystem — expected to always be present
    UMyLocomotionSubsystem* LocoSubsystem = GetSubsystem<UMyLocomotionSubsystem>();
    check(LocoSubsystem);
    LocoSubsystem->Update(DeltaSeconds);
}

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.