Description

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.

Steps to Reproduce
  1. Open UE4Editor (any project)
  2. Add code to project based on actor (MyActor)
  3. Add the following to MyActor.h:
    UPROPERTY(Transient)
    	UStaticMeshComponent* RotationMesh;
    	
    UPROPERTY(EditAnywhere)
    	float RotateSpeed;
    
  4. Add the following to MyActor.cpp:
    In the constructor:
    RotateSpeed = 4;
    

    In BeginPlay:

    	RotationMesh = (UStaticMeshComponent*)GetComponentByClass(UStaticMeshComponent::StaticClass());
    	check(RotationMesh);
    

    In Tick:

    	RotationMesh->AddRelativeRotation(FRotator(0, 0, RotateSpeed));
    
  5. Compile
  6. Add instance of the class to the level
  7. Use the Add Component button to add a static mesh to the instance
  8. Use the dropdown next to play to Simulate
  9. Select the mesh and edit the RotateSpeed property (note the speed of the mesh changes to match)
  10. Create a blueprint based on MyActor (MyActorBP)
  11. Add static mesh component to the blueprint
  12. Place instance of the blueprint in level
  13. Simulate again and change the value of RotateSpeed for the blueprint instance

Result:
Mesh will stop rotating after changing the RotateSpeed

Expected:
Mesh continues to rotate using the new value of RotateSpeed.

Have Comments or More Details?

Head over to the existing Questions & Answers thread and let us know what's up.

0
Login to Vote

Won't Fix
ComponentUE - Gameplay - Blueprint
Affects Versions4.10
CreatedJan 18, 2016
ResolvedAug 18, 2021
UpdatedAug 18, 2021
View Jira Issue