Removed C++ class still in Content Browser

Hi,

When I delete a class’s .cpp and .h file from Visual Studio, rebuild the project, the class still remains in the Editor’s Content Browser though. Is this expected? How do I clear it out this phantom class from the Content Browser?

Reproducible steps:

  1. New C++ code FPS template project
  2. Delete the game mode class
  3. Look at Content Browser… it is still there under C++ classes…

Deleting files in VS won’t delete files physically, why then it compiles non-project files you may ask? UE4 has it’s own build system called UnrealBuildTool and technically it does not need VS at all other then it’s compiler. Project files are not needed at all, they are just for convince to use VS for codeing, so modifying them won’t effect UBT at all, it build everything that is in Source directory according to build scripts (C# code you may find in source directory). So deleting files physically from source directory and regenerateing VS project file (for synchronization, you can do that by right clicking uproject file, you will see option there) is a lot more effective. It’s not really UE4 fault, VS simply expects build system to build accordingly to project file

1 Like

To clarify, I delete from source directory as well as VS, but somehow I still see the class in the Editor.

Is this the workflow I am supposed to do instead then?

  1. Delete .cpp and .h from source directory
  2. Regenerate VS project file
  3. Build the project in VS again?
1 Like

Yes after doing that you need to compile again

1 Like

There really should be an option to delete C++ class directly from the Unreal Editor’s Content Browser. Isn’t that like the basic fundamental file management functionality?