UActorComponent not Ticking

Hello,

I have a custom class which inherits UActorComponent. I’ve set…

PrimaryComponentTick.TickGroup = TG_PrePhysics;
PrimaryComponentTick.bCanEverTick = true;
bAutoActivate = true;
SetComponentTickEnabled(true);

And in the header file

virtual void TickComponent(float DeltaTime, enum ELevelTick TickType, FActorComponentTickFunction *ThisTickFunction);

But TickComponent is never called?

I tried

RegisterComponentTickFunctions(true);

But then it crashes on BeginPlay() of the parent actor?

Unknown exception - code 00000001 (first/second chance not available)

Assertion failed: GTestRegisterComponentTickFunctions == NULL [File:D:\BuildFarm\buildmachine_++depot+UE4-Releases+4.6\Engine\Source\Runtime\Engine\Private\ActorComponent.cpp] [Line: 544]

I’ve fixed it! Not sure if this is the correct way of doing it.But I added

MyComponent->RegisterComponent();

After I create it.

I had problem with ticking component too… i just deleted and added new in BP and now everything works… some kind of bug (before i turned off tick in cpp and when i turned it on again, it doesnt worked)

i have this same bug with scene component and actor component sometime tick doesnt work

i have to delete them and add them again in BP to fix it

yes - I have the same problem in bp. delete the component, add it again and it ticks - someone should open a bug report to epic? it’s 4.17

Just in case anyone else runs across this post, my problems solution to similar symptoms was simply that I had overridden the BeginPlay() function and not called the Super::BeginPlay() inside it. This causes havoc with your components setup.

I was also hung up on this problem for a bit. Turns out I forgot to add the Super::Tick(DeltaTime); to the child classes tick function. But after adding the super, the actor was still not ticking. Turns out I was missing the super from begin play as well. I feel silly. Thank you for this! haha

I forgot to call Super::StartPlay() on my AMyGameModeBase,
and TickComponent is never called on AMyGameModeBase’s component .

myComponent = CreateDefaultSubobject<UMyClass>(TEXT("MyName"));
myComponent->RegisterComponent();
myComponent->PrimaryComponentTick.bCanEverTick = true;
myComponent->SetComponentTickEnabled(true);

Also check that this code runs in both constructors: default and with (const FObjectInitializer& ObjectInitializer)

1 Like

For extra context, you most likely have to restart the editor for property changes in the constructor to take effect. Think of it like changing default values or structure changes. Hot reload is great with logic changes but not so much with other things.

RegisterComponent() works only in editor. You won’t be able to package with RegisterComponent()

ty ty . this worked for me on c++ side of the river ^