Hello,
Learning UE5 and going through this animation tutorial and I want to see if I can recreate some of the steps entirely in code for practice, more specifically this
I added this basic UAnimInstance to update Speed/Direction/IsCrouched/IsJumping via code instead of blueprint
.h
UCLASS()
class TESTGAME_API UMainCharacterAnimInstance : public UAnimInstance
{
GENERATED_BODY()
public:
virtual void NativeThreadSafeUpdateAnimation( float DeltaSeconds ) override;
UPROPERTY( EditAnywhere, Category = "MainCharacter" )
float _Speed;
UPROPERTY( EditAnywhere, Category = "MainCharacter" )
float _Direction;
};
.cpp
#include "MainCharacterAnimInstance.h"
void UMainCharacterAnimInstance::NativeThreadSafeUpdateAnimation( float DeltaSeconds )
{
_Speed = 50.0f;
_Direction = 10.0f;
}
I then created an animation blueprint in the editor and changed the parent class to UMainCharacterAnimInstance. But the variables _Speed and _Direction dosn’t show up to where I can use them in the editor - what am I missing here?