Adding a component directly to a blueprint does not behave the same as a component added directly to a class/BP instance.
Example:
Calling AddRelativeRotation() on a mesh that is added directly to a class instance will continue to rotate if the rotate speed is changed. Calling the same function for a mesh added to a blueprint causes the mesh to stop rotating if the rotate speed changes.
UPROPERTY(Transient)
UStaticMeshComponent* RotationMesh;
UPROPERTY(EditAnywhere)
float RotateSpeed;
RotateSpeed = 4;
In BeginPlay:
RotationMesh = (UStaticMeshComponent*)GetComponentByClass(UStaticMeshComponent::StaticClass()); check(RotationMesh);
In Tick:
RotationMesh->AddRelativeRotation(FRotator(0, 0, RotateSpeed));
Result:
Mesh will stop rotating after changing the RotateSpeed
Expected:
Mesh continues to rotate using the new value of RotateSpeed.
Head over to the existing Questions & Answers thread and let us know what's up.
0 |
Component | UE - Gameplay - Blueprint |
---|---|
Affects Versions | 4.10 |
Created | Jan 18, 2016 |
---|---|
Resolved | Aug 18, 2021 |
Updated | Aug 18, 2021 |