Why TickComponent function is called even I don't click the play botton

Hi, everyone!
There is a strange thing in my unreal C++ project.
I created a SceneCaptureComponent2D based class in the editor, and added it to a StaticMeshActor in a level by “Add Component”. Then I writed some lines of code in the TickComponent function.
According to my knowledge, the TickComponent function is only called when the play button is clicked. But in my project this function is called although the play button is not clicked. I clicked the play button, this function is also called. I feel really confused.
Just like in picture below. I didn’t click the play button, but the break point in TickComponent was triggered.
Does any one have any idea about this phenomenon?

This is normal if component you basing on is also ticked in editor, you need to set bTickInEditor to false in component to disable that. But before that i recommand to check the code of original to see if you not going to block some importent code that might bug out the component behavior (if you overriding without calling Super you already doing so)

https://github.com/EpicGames/UnrealEngine/blob/1d2c1e48bf49836a4fee1465be87ab3f27d5ae3a/Engine/Source/Runtime/Engine/Private/Components/SceneCaptureComponent.cpp#L484

And as command in constructor states there:

// Tick in the editor so that bCaptureEveryFrame preview works
bTickInEditor = true;

Don’t be shy to look on engine code, aspecially if you extending existing functional component, remember that your code becomes part of already existing one so they should not conflict eachother

2 Likes

Hi, ! Thanks for your advice.
I just commented out “PrimaryComponentTick.bCanEverTick = true;” in my BeginPlay function, and then only clicking play button can trigger the TickComponent function. I wonder if it is a proper way to solve this issue, but it works for me.
I’m a freshman to unreal engine. Thanks again for your suggestion!!!