After compiling, the Barrel's static mesh gets reset to None?

Hi all,

each time I compile, the Barrel’s static mesh gets reset to None. Am I missing a setting somewhere? Attaching a picture to describe what I mean. I’m using Unreal 4.20.1.



I have the same problem but with the tanks tracks, and not just the mesh but other things will be reset to their default values. I tried to debug my code for hours before I saw that the physics material had been reset to “None”.

1 Like

Hi, I was having this problem as well. I read this post by chardzard on the UE answers forum:

My problem seems to have ended up being that my MaxDrivingForce variable of my TankTrack was public rather than private. I moved it to private and added a category to the UPROPERTY and after that it stays (at least so far). Weirdly and probably related when I change the default value for MaxDrivingForce and compile my tracks in my Tank_BP become null. This or something similar may be what’s going on with OP’s problem too. This was happening on 4.20.1 and 4.20.2 for me.


I’ve just workaround this error by setting those static meshes in blueprint like here (On the event graph tab):


you’ll see no turret and barrel on the editor but as soon as you play you’ll have those meshes there.


Had this problem as well and used a similar workaround. Just a small addition, if - like me - you’d also like to see the barrel mesh in the editor: If you add the same nodes in the construction script of the tank BP, it’ll assign the meshes right at construction time, i.e. when the object is placed. That way you might not even notice the difference between the workaround and the best-case scenario. :slight_smile:


This happened to me - every time I compiled in Visual Studio I lost the reference and had to re-add it. I discovered that if you delete the old item and hit the “Add Component” button, selecting the new C++ extension for Barrel and Turret that it stopped losing the reference.

It seems that if you add a C++ component, and have it provide the template code that the component created at that time is bad.
Try removing it and doing the “Add Component” for the new item AFTER compiling the newly created classes.


I tried the same, but now every time I open up the Unreal Editor, my tanks all fly around the world. Any ideas as to what could be wrong?

It worked for me :slight_smile: Thanks!

Privacy & Terms