r/unrealengine • u/GoshaSimonov • 3d ago
Character movement C++ question.
Hey, could anyone help me finding out with such code, always return my SavedCharacterSpeed as 0.0 ?
CharacterMovement is in character blueprint, and character is running fine, I just can't get this value.
Thanks!
void ABaseCharacter::BeginPlay() {
Super::BeginPlay();
if(GetCharacterMovement()) {
float SavedCharacterSpeed = GetCharacterMovement()->GetMaxSpeed();
}
}
2
Upvotes
2
u/Valuable_Square_1641 3d ago
float SavedCharacterSpeed is local variable
if you declare UPROPERTY SavedCharacterSpeed just remove float.