So to be short, I faced the same problem and found a solution. The first tip is always to Open the project from the launcher. For some reason, opening a project from IDE make the compiling process weird.
When you open the project, you may find none of your C++ code available! At this point, you should hit the C++ compile button to get your codes back.
But still, the changes you made to your level may not be available. Then you have to Build the level, and everything will be where you left it before.
I don’t know how to stop this from happening. But it should be enough to save your efforts. Also, take note that after applying this, all the changes you lost could return, not only the last one.
I hope this work for you guys as well.