How to remove a C++ class from Content Browser?


I’m trying to delete a C++ class that has been added with the “Right Click → New C++ Class” functionality inside the Content Browser. If I right-click the component, the “delete” option is greyed out (and so is rename).

What I tried:

  • Close UE4 / VS, delete the files manually in explorer and let UE rebuild the VS file (see here)
  • Remove them via Visual Studio

However, even if completely deleted, the component still shows up inside the Content Browser and there seems to be no way to remove it from there.

There seem to be several other questions about it. The answer there wasn’t really related to the problem though (since it still compiles successfully).

Do you see that component in Class Viewer?

Did you restart the UE4 Editor?

Yes, several times.

Yes, in there as well as in the Content BRowser, see:

Those are the only 2 occurences, but the source files are long deleted anf if I doubleclick on the PlaygroundCharacter in the Content Browser, it’ll say “Can’t find source files”.

Still can’t get it out there, though. It doesn’t break anything, it’s just annoying.

  1. Did you try running VS2013 while UE4
    is closed, and then press CTRL+F5
    when your project solution has
    finished loading?
  2. Did you try re-generating project files using the UPROJECT file in your UE4 Project root folder?

I also have this same problem but I can’t find the way to remove files in Content Browser. It seems like a bug.

Delete Binaries folder after you close Visual Studio and UE4. Regenerate project files. Open VS. Build project. Confirm if build is successful. CTRL+F5 in VS if successful. Wait until UE4 appear. Check to see if C++ class you want removed is gone.

Edit: Forgot that you need to delete whatever C++ classes you want removed first before you do all of the steps above in the File Explorer, not in UE4 Content Browser.

1 Like

The same problem here. Using Unreal Editor 4.10.1 and no idea how to delete C++ class.

Hello x27,

Have you tried Asperatology’s method? You should be able to remove a C++ class by deleting it’s source files (.cpp and .h) in the Source directory of the project and then deleting your Binaries, Intermediates, and Saved folders. After that, you need to Generate Visual Studio project files by right-clicking the .uproject file. You should be able to compile and then no longer see the class that you deleted inside Visual Studio or the editor.

I have tried the above methods before and, yes the classes did disappear from the content browser but later I had problems with crash on compile. I found a very hokey workaround. I move the entire project into another folder I then recreate the project with the same name. I recreate all of the classes I wanted to keep and give them the EXACT names as before so I can cut and paste from the desired classes. I then move the levels and assets over in windows explorer. This is probably the worst way to do this but it seems to be the “cleanest” way to do it. I have a couple of classes in my current project that I would like to get rid of but I am going to wait until nearer the end to do this clunky “reboot”. I would love to hear input from the more knowledgeable C++ devs out there on how better to do this.

asperatology’s solution worked for me !

The easiest method is to open any file in Visual Studio, then close Unreal Engine and just hit Rebuild Solution in VS (Development Editor). This will rebuild binaries that have the info about the deleted files. Open Unreal Engine and all the actual files should be there and deleted shouldn’t be there.