BlendSpace variable set via C++ not updating the SkeletalMesh?

Hey guys,

I have a custom UAnimInstance called MonoWheel_AnimBP and I’m using it to declare a few variables that I’m using on an animation blueprint that derives from this MonoWheel_AnimBP.

In this blueprint, I have a Blend Space 1D that controls the steering left/right of my character. I’m setting this value via C++, through the NativeUpdateAnimation function. I’ve called a UE_LOG to check if the value was being updated and it is, but I see no difference in the game.

Also, in the preview, if I change that value by hand, the character behaves just right (pictures below).

MonoWheel_AnimBP looks like this:

UCLASS(transient, Blueprintable, hideCategories = AnimInstance, BlueprintType)
class JOGODECARRO_API UMonoWheel_AnimBP : public UAnimInstance
{
public:
	GENERATED_BODY()
	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Engine)
	float steering;
	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Engine)
	float wheelRPM;

	virtual void NativeInitializeAnimation() override;

	virtual void NativeUpdateAnimation(float DeltaTimeX) override;

	AAMonoWheel *monowheel;
};

and it’s cpp file:

#include "MonoWheel_AnimBP.h"

void UMonoWheel_AnimBP::NativeInitializeAnimation()
{
	Super::NativeInitializeAnimation();
	monowheel = Cast<AAMonoWheel>(TryGetPawnOwner());
}

void UMonoWheel_AnimBP::NativeUpdateAnimation(float DeltaTimeX)
{
	Super::NativeUpdateAnimation(DeltaTimeX);
	if (monowheel)
	{
		UE_LOG(LogTemp, Warning, TEXT("MonoWheel is being set. current steering is %f"), steering); // this value gets updated.
		steering = monowheel->currentSteering;
		wheelRPM = monowheel->GetMonoWheelRPM();
	}
}

The blueprint Anim Graph looks like this:

Also, when I update the steering value, I can see the preview changing:

Also I must point out that the value for wheelRPM works in game, it looks like the problem is specifically with the Blend Space 1D which doesn’t update.

Both wheelRPM and steering are the variables declared on my UAnimInstance.

Thank you!

If you plug just your blendspace into the Final Result does it work? Are you playing any montages? If you play in an editor window and attach the previewer to the ABP does the steering variable reflect the correct value (or use print statements)?

I use a variety of pawn c++ variables on my pawn (just like you) and getting those values work, however I do not use an extended UAnimInstance. Using 4.8.2.

Thanks for you reply,

If I plug just the blendspace, it still doesn’t work. I’m not playing any montages.

I noticed that if I debug the animation blueprint and hover the ‘steering’ value, it displays what is being printed, however the value on the left corner doesn’t update. So the blendspace is receiving the value, but it’s not updating the mesh…

I was also doing that via blueprints before I switch to C++, with the same effects, which means none. =/

An image to illustrate what is going on:

Also, why does it say ‘None’ in the input of my BlendSpace? Shouldn’t it be ‘steering’?

Was there any resolution to this? I’m having a similar problem. I have a variable being updated in C++ and it’s changing according to UE_LOG output run in the C++ code, but fetching the value in the UE4 blueprint shows no change.

Same issue here, did someone find the answer?

Hello bmadhlbrand,

I actually don’t remember exactly how I solved it.
I think I had the same issue with my pelvis rotation which is a variable declared in C++ and used by my AnimationBP.

The AnimationBP looks like this now:

The variable Pelvis Rotation is delcared in C++ as follow:

public:
	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Pelvis)
	FRotator PelvisRotation;

I hope this will help.

Did you figure this out?