UCharacterMovementComponent::GetCharacterOwner
#include "GameFramework/CharacterMovementComponent.h"
Access: public
Specifiers: UFUNCTIONBlueprintCallableconst
Description
Returns the Character that owns the UpdatedComponent this movement component is driving.
Caveats & Gotchas
- • Returns nullptr if the component isn't currently updating a capsule owned by a Character — for example when used standalone or while the owner is being destroyed.
- • This returns a cached pointer (CharacterOwner) set when the updated component changes, not a fresh Cast<ACharacter> every call — cheap to call frequently.
Signature
ACharacter* GetCharacterOwner() const Return Type
ACharacter* Example
Access the owning character from a custom movement mode C++
void UMyMovementComponent::PhysCustom(float DeltaTime, int32 Iterations)
{
if (ACharacter* Owner = GetCharacterOwner())
{
Owner->Jump();
}
} Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?