Tick function won't run on Tank c++ class

image

Currently going through ToonTanks(v2) and I’m currently at “Using the Mouse Cursor” where I noticed the red debug sphere does not show during gameplay because the tick function does not run but I can confirm the debug sphere code works in BeginPlay.

For the course I’m using UE 5.0.3 and Visual Studio 2022 Community.

I have done the following:

  • Closed the UE editor, built new solution and restarted.

  • Generate Visual Studio Project Files

  • Deleted VS, Binaries, Intermediate & Saved files then Generate new Visual Studio Projects.

None have worked but I found a temporary solution. In the BP_Tank class, by enabling “Allow Tick Before Begin Play” the tick function works as expected.

Screenshot 2023-11-15 164739

I haven’t done that class, but does your ATank constructor enable tick? It should look something like this:

AAuraCharacterBase::AAuraCharacterBase()
{
	PrimaryActorTick.bCanEverTick = true;
	

Yes, I have included my ATank Constructor to enable tick but still it does not work.

Did you recreate the blueprint after doing that?

Yes and made no difference. The code won’t runt unless I enable “Allow Tick before BeginPlay” on the BP_Tank.

Well if you want I could take a look at your project using the following link.

https://gdev.tv/projectupload

Please use File > Zip Project within Unreal as this will ensure only required files are zipped up and things like the Binaries are excluded.

I solved it in the end. After trying to use the Tick function in other pawns/actors, nothing I wrote inside of the tick function ran. I concluded something got corrupted while I was generating new visual studio files and deleting the binaries, DerivedDataCache, Intermediate and Saved folders.

I restarted the project from scratch and everything works fine now.

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms