C++ Components are removed (and/or instances reset) from their actors on Editor restart


I’ve been noticing that custom c++ components didn’t persist when I restart Unreal Engine (5.0.1). I thought at first that it was a bug with the file saving, but it seems that at startup the c++ classes aren’t recognized so they get removed from their attached actors. Leading to losing any custom instance values that have been set before.

Any ideas how to solve this ?


I did come across the same issue. As I can see it is still not solved?

Sorry I was going to update my post as I just received an answer on Udemy’s Q/A forum too. There I was told to disable Live Coding and it does seem to resolve the issue.

While finishing the training course earlier I stumbled upon a fix for when using Live Coding. If you just want to finish your work and close the project make sure to also do a Build on VS Code (Ctrl+Shift+B) with the option “[ProjectName]Editor Win64 Development Build”.

I noticed that for some changes in header files or when creating some new classes you have to close the Editor and do this Build to update the project binaries. This was when I noticed that the Actors and Components kept their values as intended.

Though I’m still not sure what are the specific cases when the Rebuild and UE restart are required and when the Live Coding compile (Ctrl+Alt+F11) is enough.