I can remove the class and header files from my project, but then it still shows up in the editor as selectable base class for my blueprints. What do I have to do to completely remove all of the generated code?
Are the files also removed from the Source/GameName folder as well and has the project then be recompiled? There is also a refresh visual studio files under the ‘File’ bar in the editor which may help.
Just removing the files from the VS project won’t work. Maybe it’s because UE provides so much custom compiling tools and helpers etc… however it reads files based on file/folder structure.
To remove a class
- Either remove the class files entirely from project directory
- Or rename file extensions to e.g. .cpp_ and .h_. This will make sure compiler ignores them, too.
After removing the .cpp and .h files you also have to rebuild your project (and any other modules that used your removed code). The DLLs in your project will not update until you rebuild them in Visual Studio. Once you rebuild the modules, all generated code for your removed classes will also be removed.
If your code is loaded in the Editor, you may also have to hot-reload your module in the Editor, or if your module(s) don’t support hot-reloading then you would have to restart your Editor.
I’m having the problem where I have done all this but my UE4 project still references the class and I cannot seem to get rid of it
This didn’t work. I can’t create another class of the same name because
the name TGItem is already used by another class, even though I have deleted the .cpp and .h files and rebuilt the solution.
Edit: I also had to go into the source folder, rename the files with a .txt extension so that they are ignored, and then rebuild again. After that it worked.
This worked, but I had to rebuild again after renaming the files.
Hi all, I just ran into this problem and opened this question looking for answers,
luckily this is solved easily:
1.Close Visual Studio.
2.Backup “Source” folder just in case.
3.From the “Source” folder, delete the .cpp and .h files of class you want to remove from project.
4.Open Visual Studio, and “remove” those same files from the list.Hit “Save”.
5.In Visual studio click “Build->Clean Solution”
now you can continue coding , it will compile.