Compiling my code resets all my Tank_BP references

I have this… issue that every time that i compile my code my static mesh componenets get reseted ,
have anyone with this same issue?, it’s pretty annoying to try to update your code and have to set again the static mesh i’m on Unreal 4.20.

Sometimes the player tank doesn’t have throttles, turret and even the barrel when i hit the play button :rage:

any suggestion?

-EDIT-
and it also resets my physics material it seems like resets all references for some reason…

1 Like

Just replying to say I’m having a similar issue, my turret and barrel keep having their static meshes reset to none. I am currently only on lecture 159, so I haven’t gotten to movement yet, but I can see having similar issues there.

1 Like

Yeah that’s pretty annoying to set back all the references, i’m on the lecture 190 but like 30 lectures before i had the problem, i thought that was my fault but i researched a bit and it seems that is a Unreal bug, sadly for me, because i’m on the lastest version and the people have reported that since 4.16 they told that they just updated to a new version and it has been fixed.

Ok, i made a lot of changes so i don’t really know about which one could fix this problem, but the most important in my opinion was to rebuild the tank_BP, this measure showed good sings while i was building it again and compiling even reopening unreal engine, the references were intacted, so, i recommend to opt for this measure first, secondly, i replaced the UCLASS statement to:

UCLASS (Blueprintable, BlueprintType, ClassGroup = (Custom), meta = (BlueprintSpawnableComponent))

on all components class (.h) where were needed, finally, i opted to update visual studio as i had problems with the Intelisence i guess that could fix this problem but i have my doubts.
Hope you all can fix your similar problems i guess it was only Unreal being awkward.

Good Luck!

1 Like

I narrowed down what the problem was for me at least. I noticed my tracks weren’t disappearing while my barrel and turret were. So I looked in the code to see what was different, and it turns out that the tracks didn’t have any private variables, where the barrel and turret did. So I made the variables public for both classes, and it was fixed instantly. Very strange, seems like an engine bug.

Never mind, that didn’t fix anything. I have no idea what’s going on. I thought I had it. I’m so confused.

Edit: 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.

I am on 4.20 and just got through lecture 148. As I was testing I was getting the same issue and it was driving me insane.

After an hr, I decided to just make a copy of the original with Copy and Paste and renamed the Tank_BP and reassigned it in the Level Blue Print settings and now it works and I don’t have any issue.

2 Likes

I’ve submitted a bug report about this, and there’s an issue now in with them here: https://issues.unrealengine.com/issue/UE-63298

2 Likes

EDIT: Well, it worked for a while. but I now it’s back to resetting again. :frowning:

I tried moving the vars into public. didn’t work out. but your solution worked!

I made a copy of Tank_BP as Tank_BP1, re-assigned all the references to this copy, deleted the original and now I can change code, recompile etc and the static mesh remains.

Thanks!

Thanks for submitting the detailed report. I voted.

I had similar issues with my Tank_BP continually losing the left/right track meshes and physics material collision settings. It always seemed to occur after a compile in C++ code, even a full project reset would not fix it. I also tried recreating the tank blueprint from scratch. That, too, did not solve the issue.

The only thing I could think of was that the project was upgraded from 4.18 (I think, maybe 4.19) to 4.20.

I have since recreated the BattleTank in 4.20 from new and so far have not witnessed a single problem. Hopefully I have not now jinxed things and the project will starting failing again. I’m not sure if anybody else experiencing the problem is working on upgraded Unreal project.

Hope this is of some help.

Chris.

*** Edit ***
I spoke too soon… a compile of C++ code with the only change being some new comments being added caused the tank to lose the track meshes and sockets in the blueprint.

Yeah, I’m experiencing similar stuff, though in regards to Tank_BP settings. It doesn’t remember the Projectile_BP after a Compile, so I have to manually add the Projectile_BP to the Tank_BP’s TankAimingComponent every time I want to play. I was considering remaking the Tank_BP, but I opted for replacing just the Tank Aiming Component portion, and it’s worked SO FAR, so I recommend only replacing the bad component first before remaking the entire blueprint.

Aware the thread is old but just in case this can help anyone the solution I found was to set your mesh in the BP and save as normal, but build the solution with your code editor first (Visual Studio) don’t compile in unreal. Then moving forward using unreal to compile was fine as normal but yeah if you run into things disappearing from blueprints for me at least building the solution in code editor first worked.

1 Like

I think this is the same issue of UE-52220. Good news: fixed in 4.26. Bad news: 4.26 isn’t out.

2 Likes

I tested it on Unreal Engine 4.26.2 and the issue still persists.

Barrel and Turret Static Mesh property reset from Tank_BP every time I compile the C++ code. I need to keep adding it every time I compile.

Is there any way to set the static mesh property from C++ directly as a workaround?

Issue still persists in Unreal 5

Privacy & Terms