Download

Can't get value for Rotator

so I’ve wrote some code to get a value for a variable. Then when I try and get a print out for that variable in my character blueprint, it reads as 0,0,0. Why is this when I can print debugmessage in C++ and the values read correctly?

The code is in the tick function, and the Print screen node in the blueprint is called in the EventTick chain. I’ve made the variable VisibleAnywhere/Blueprint read write.

I’m really baffled by this. Here is the Code:

header:


	UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = CharacterMovement)
		FRotator MyRightStickRotator;

cpp:



if (bRotating)
	{

		FRotator MyRightStickRotator = RightStickDirection.Rotation();

		MyRightStickRotator.Yaw -= 90;

		const FRotator CameraRotation = FollowCamera->GetComponentRotation();
		const FRotator YawRotation(0, CameraRotation.Yaw, 0);

		MyRightStickRotator.Yaw += CameraRotation.Yaw;

                GEngine->AddOnScreenDebugMessage(-10, 1.f, FColor::Red, FString::Printf(TEXT("Vector: %f %f %f"), MyRightStickRotator.Pitch, MyRightStickRotator.Roll, MyRightStickRotator.Yaw));


	}

The character blueprint:

0578435bb7dad044ef1030e41d2b14c9f8250cdd.jpeg

Any help would be great thanks.

I’m still struggling with this.
Any help please?

It seems to be working for me.

Are you sure you don’t have several instances of that blueprint in your scene, and you are looking at the wrong one?

Just created a UPROPERTY in my ACharacter derived class:



	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = TestLol)
		FRotator TestRot;


In my Tick function I’m just setting some value to be able to test it:



void ATestCharacter::Tick(float DeltaTime)
{
	Super::Tick(DeltaTime);

	TestRot = FRotator(0, DeltaTime, 0);
}


Then I have the same BP setup in my BP attached to the Tick event.

If you can’t figure it out, I recommend reducing your problem domain until you can see the actual problem.
Basically create a simple test class to isolate the involved components and see if you can get that to work. Then gradually add on more stuff until you find the problem.

Good luck and best regards,
Temaran

Thanks Temeran. I could get it to work with a simple float that increases in Tick, but I still couldn’t get my rotator to read out correctly. In the end I followed one of Rama’s tutorials and made a BlueprintImplementableEvent function which fired out my calculation of the rotator through the event.

Thanks