I have created the actor MyEarth which loads a staticmesh from Content Directory and the class MyGameModeBase (derived from GameModeBase) which spawns an instance of MyEarth in a position. Everything works fine, the actor appears as expected.
But,after saving eveything,when i reopen the project, my c++ classes MyEarth and MyGameModeBase are no longer in the C++Classes Folder of the Content Drawer of the Editor,and when i run the project,nothing appears and no MyEarth actor in the Outliner.
Obviously the class code is there,in the Source Directory of the project.
Why does this happen? Similar problem in a my previous post with blueprint.
I find NO solution. Maybe a bug ? Thanks in advance !!! This problem is a stop with Unreal Engine for me.
This is part of the code:
Are you launching through the launcher or are you launching through your IDE? Try deleting your intermediate and binaries folders, and then try launching the project again. It will have to rebuild your code but it should work. If you are using your IDE to launch, make sure you’re building using the Development Editor configuration, because this is what the launcher uses.
I’m using Live Coding in UE 5 since Early Access. I don’t think that’s the problem. Live Coding worked fine in Preview builds also (from Epic Launcher) and I don’t have any issues with 5.0.1 either. I think further investigation is needed as Live Coding might not be the culprit in my opinion.
Thank you Zeaf. I launch the project from the launcher and i use the ide to write c++ code.
I have deleted intermediate and binaries folders,then the launcher asks me if i want to rebuild the project. After that,when i open the project,my classes reappear again but when i open visual studio,the editor tells me that the project does not exist.
So,after deleting intermediate and binaries folders and rebuilding
i close ide and project,and then open again the project
In World Settings/ GameMode override,i select MyGameModeBase (derived from GameModeBase),this is fundamental!
if i open visual studio,the project is there,with all the code.
One more thing you can do if you find yourself opening the project from the launcher is to go to Edit → Editor preferences, search for “Force compilation” and tick the box there. That way your project will automatically compile the code if there are any changes any time you launch it from the launcher or by double clicking the uproject file
Small update. I forgot to write that before opening visual studio you need to Refresh Visual Studio Project from Tools of Unreal Engine Editor,otherwise visual studio keeps saying that the project doesn’t exist.
Thanks
I have followed the steps here, but I am still missing several C++ files and also folders. I do have live coding enabled. Deleting binaries and intermediate folders, then regenerating the VS file does not help at all for me. Interestingly this is not happening to my colleague. Both of us on 5.1,
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.
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 found the root issue is from live coding. Everytime I relaunch UE5.4 with live coding enable, all my c++ will disappear. But my c++ still appear if live coding is disabled. Defenitely bug and Epic need to fix this asap.