AITank turret and barrel disappear when game opened from menu


When I got to the lecture about adding the quit button to the menu, the AITanks’ turret and barrel disappear when I start the game from the menu. If I restart the game directly from the main map I get the same issue.

All meshes are set correctly in the blueprint. I found this post and I added the meshes to the construction script of the tank blueprint, but this hasn’t solved the issue. The only thing that seems to work is to remove enemy tanks and add them back to the level. If I then launch the game from the main map the tanks look fine, but if I go back through the menu the turrets and barrels disappear again.

Note the tank and barrel don’t disappear on the player tank (although I’ve had a separate issue where they disappear on the PlayerTank when I edit UPROPERTY values.)

I’m on Windows 10 running Unreal Engine 4.22.3

Could you show your construction script?

Attached. I added the Print String node to make sure it was running and I do see the message when the game starts

That is strange. Does it work if you put it in BeginPlay?

That is strange. Does it work if you put it in BeginPlay?

Do you mean I should try to set the meshes in C++?

I meant in the blueprint’s begin play

That solved it when I launch the game, but after going through the menu the turret (and barrel) still disappear in the editor :man_shrugging:

My code is in Github. Note I’m using Git LFS for storing large files.

UPDATE My game went really weird when I implemented the C++ classes for the tank tracks in the next lecture. I went back in git history which necessitated the removal of the use of Blueprints to set the meshes. The turret and barrel disappearing is annoying but I can work around the issue for now. I’ll revisit this when I get to the end of the course.

Thanks for your help though @DanM!

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

Privacy & Terms