TickComponent not called (c++)

Hi,

I have a UActorComponent, here is my constructor

USwitchComponent::USwitchComponent()
{
	PrimaryComponentTick.bCanEverTick = false;
	PrimaryComponentTick.bStartWithTickEnabled	= true;
	PrimaryComponentTick.TickGroup = TG_PrePhysics;
	
	bAutoRegister	= true;
	bWantsInitializeComponent = true;
	bAutoActivate	= true;
}

But TickComponent not got called, I add everything I read in the AnswerHUB.
The component is attached to a staticmesh (I set to moveable too), the Component is not a SceneComponent.

Any ideas? I try all in my knowledge.

thanks

I think you shoud change:

PrimaryComponentTick.bCanEverTick = true;

1 Like

I had a similar problem but in my case, In BeginPlay() method, I forgot to call Super::BeginPlay() and Tick Stoped working.

In my case this was caused by a Hot-reload issue.
Solution was to recreate a variable

Symptoms: The BeginPlay was called. If I added the component via blueprint it worked, but Tick method was not called if I add the component via c++ .

Solution:
I created duplicated the variable name and creation with 2 and it worked

UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category=Input)
UPlayerAimingComponent* PlayerAimingComponent2;

// ... 
PlayerAimingComponent2 = CreateDefaultSubobject<UPlayerAimingComponent>(TEXT("PlayerAimingComponent2"));

double-check that BeginPlay is called.