Tick function in classes that inherit from classes that inherit from AActor

So I have a class, called APancake, that is derived from AActor. If I set it up with the Super::Tick(DeltaTime) function and try it on this (such as making it float up and down), it works just fine.

Now I have another class, called ABlueberryPancake, that is derived from APancake. If I set it up with the Super::Tick(DeltaTime) function, and try to make it do the same thing, nothing happens. It doesn’t even log anything when I put a UE_LOG function in there.

Why does this happen, and how do I fix it?

Uhm it Works like expected you got a User Made error on your Side (Can you Provide Source if you dont find the Error?). Are you sure you have everything done right and not set bCanEverTick to true, virtual Keyword etc. etc.? Aside from that we are Talking about two C++ classe or C++ and Child BP Class? If its a BP Child make sure to rightclick the Event Tick and Add Call to Parent. Otherwise it wont execute the Parent Tick. Screenshot - d72f442b87f7a89664fccb67da03b8e0 - Gyazo

Does PrimaryActorTick.bCanEverTick need to be set to true or false? Right now both of these classes are set to true. And I am not using Blueprints at all, only C++ classes.

Sorry that was a Brainfart on my side while typing. They both need to be True so Tick gets executed. If you put a UE_LOG in your Child Class does it show up in the Log? If it does not Log you messed something up in the .h most likely.

In the class that derives from AActor, UE_LOG does show up and it runs normally.

void APancake::Tick(float DeltaTime)
{
    Super::Tick(DeltaTime);
    UE_LOG(LogTemp, Warning, TEXT("The pancake."));
}
// This function is called.

In the class that derives from that class, it does not, which indicates that Tick is never even called.

void ABlueberryPancake::Tick(float DeltaTime)
{
    Super::Tick(DeltaTime);
    UE_LOG(LogTemp, Warning, TEXT("The blueberry pancake."));
}
// This function is not called.

They are exactly the same in both the .h and .cpp files, yet one works and the other does not.

Hmz =/ here the bare minimum in my Example:

Screenshot - ab1000a0d6a379bbd9201c60080fce52 - Gyazo // .h

Screenshot - 46aac50a679073c2b05758e9c29f17b4 - Gyazo // .cpp

Result: Screenshot - fd92e9e44ef040411ae04acdbedd3d44 - Gyazo

Im not sure how you can go wrong there. Just to make sure you did drop a Blueberry Pancake Actor into your World right?

Im heading to Bed now but here are a couple things you could try:

Close the Editor, Build from Visual Studio, Make sure the Build was succesful (Output Log), Test it.

Make sure the .h and .cpp files are in your Source folder and not in the Intermediate folder. If they are move them to the source folder.
Rightclick your .uproject and “Generate Visual Studio project Files” repeat the first suggestion again.

Yes, and in fact their other functions work properly. It’s just something about the Tick function.

This is highly distressing… your code is identical to mine, and yet yours clearly works and mine does not. I think this problem may be a bit deeper, maybe it has something to do with my computer… it seems I"m the only one that has this problem. Thanks for your help and please tell me more if there’s anything else I could possibly try.

Hmm the two things I would try is simply recreate the class from scratch. To be sure you dont do anything wrong rightclick your Baseclass in the Content Browser and hit create C++ Child class.

You can also nuke any Compiled Data and Cache by Deleting the DerivedDataCache and Intermediate folder. It will take some time to recompile everything including shaders etc. but its save to delete them.

Otherwise Im out of wisdom at this Point I never experienced any trouble with what you are trying to do.

I was just getting this bug, but it turns out that it was because I had changed the inheritance structure of the actor after an instance had already been added to the map. Any new instances added after the inheritance was changed had a working tick.

Not sure if that answers the original question, but it might help others who had the same issue I had and were led here. Of note, I was using blueprint with this inheritance:

[blueprint class]->[blueprint class]->[native class]->[AActor]