UAnimInstance::FindSubsystem
#include "Animation/AnimInstance.h"
Access: public
Specifiers: const
Description
Searches for an animation subsystem of the specified type on this anim instance. Returns nullptr if no subsystem of that type has been registered, making it safe for optional subsystem access without asserting.
Caveats & Gotchas
- • Returns nullptr if the subsystem type has not been registered on this anim instance, unlike GetSubsystem which may assert. Use FindSubsystem when the subsystem may or may not be present.
- • Template-based — the subsystem class must derive from UAnimInstanceSubsystem. Passing a non-subsystem type will fail to compile.
Signature
template <typename TSubsystemClass> TSubsystemClass* FindSubsystem() const Return Type
TSubsystemClass* Example
Optionally access an animation subsystem C++
if (UMyAnimSubsystem* Subsystem = AnimInstance->FindSubsystem<UMyAnimSubsystem>())
{
Subsystem->UpdateLocomotionData(NewVelocity);
}
// No subsystem found — graceful fallback See Also
Tags
Version History
Introduced in: 5.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?