Class inheriting from UStaticMeshComponent having private variables causes the static mesh in blueprint to be reset on editor or level load

Steps to reproduce:

  1. Checkout this commit.
  2. Edit either TankTurret.h or TankBarrel.h to make the member variables private or protected
  3. Compile code
  4. Reload editor or switch to MainMenu level and back to BattleGround level
  5. The Tank_BP should be missing either the Turret static mesh, Barrel static mesh, or both depending on changes from step 2.

I have only tested this with 4.20.1 but it may be present in other versions as well.

Edit: I haven’t actually managed to figure out what’s wrong consistently. I thought it was having private variables, but it’s happening again now with public variables too. I have no idea what the cause of this is.

Edit the second: Ok so it is in fact private/public variables causing the bug, but when the private variables are made public again and the code recompiled, I have to delete and re-add the components in the blueprint for the fix to stick.

Edit the third: this is now under issue number UE-63298

Hello,

We’ve recently made a switch to a new bug reporting method using a more structured form. Please visit the link below for more details and report the issue using the new Bug Submission Form. Feel free to continue to use this thread for community discussion around the issue.

https://epicsupport.force.com/unrealengine/s/

Thanks

Thanks for posting this chardzard. I was having this same problem with my TankTracks and resolved it by making the public MaxDrivingForce private.

Just wanted to add that I’m following this course as well and came across this exact bug.

Just a quick update, after submitting a bug report through the new method, there is an issue entered here: Unreal Engine Issues and Bug Tracker (UE-63298)

Same Issue here with 4.22.3, fixed making private variables public:

Years later this is still happening.