Setting PrimaryComponentTick.bCanEverTick in a custom actor component's constructor does not does not stop the component from ticking after compile.

Steps to Reproduce
  1. Open UE4 Editor (Any project)
  2. Add code based on ActorComponent (MyActorComp)
  3. Make the following changes to MyActorComp.cpp
    • Add include statement for Engine.h
    • Add the following to TickComponent() function
      	if (GEngine)
      		GEngine->AddOnScreenDebugMessage(-1, 4.f, FColor::Magenta, TEXT("Component Is Ticking"));
  4. Compile
  5. In the editor, create a blueprint based on actor (MyActorBP)
  6. Add instance of MyActorComp to MyActorBP component hierarchy
  7. Add instance of MyActorBP to the level and PIE (note that debug message prints)
  8. In MyActorComp.cpp, Set PrimaryTickComponent.bCanEverTick to false in constructor
  9. Compile with the editor open (Hot reload)
  10. PIE

Debug message is still shown on screen

Debug message is not printed since component is set to not tick.

Have Comments or More Details?

Head over to the existingAnswerHub thread and let us know what's up.

Login to Vote

ComponentGameplay - Components
Affects Versions4.
CreatedMar 15, 2017
UpdatedSep 6, 2020
Pull Requests
5830 - Algorithman