Delete C++ Class

It’s incredibly silly that a Game Engine this sophisticated does not accommodate simple C++ file deletion from content browser. What’s more embarrassing is that the deletion must be done manually, from Windows Explorer. After that, developers must close the UE editor, Rebuild the solution in VS, then relaunch the UE editor.

As a game developer, creating and deleting classes during development and testing is a common thing to do. In fact it’ll be very often. So why won’t UE developers provide a more convenient way of doing this? Just provide the delete option in UE editor for any asset, including blueprints and C++ classes.

Issue is Class =/= code file, header file can contain diffrent things like structs and enums as well as cpp can have code from other classes from unrealed header file (i seen such cases in engine code) thats why (i think not sure what Epics things about it) it impossible to implement class delete in reliable way just by deleting logical body of a class form content browser

Also i would really not relay on “Content Browser” this was added primerly for blueprint users which are addicted to that menu, i think “Class Viewer” is superior to it. As progamer you should relay on IDE project browser show you and what you got in the code, but i know VS is very buggy with UE4 setup sometimes, but still. I personally use Codelite++ (but because VS is very slow on my PC, because of that im not sure how Vs is buggy now with UE4 ;p) and project managment there is better and in 100% sure that when i delete file there it get deleted physically too.

Hi Pelangi,

This question came up a few months ago as well. The response I provided then is still valid now, so I will copy it over here for you, and hopefully improve visibility for anyone else who is wondering the same thing.

Unfortunately the process of deleting a code class from a project is not always as simple as deleting a couple files. The Editor would be able to find and remove the header file for the class since that information is available to the Editor. However, even though most class source files use the same name as the header file, this is not a requirement and the Editor may not be able to locate the source file for the class in order to remove it. In addition, class method definitions can technically be found in any file within the module that contains the class. That means the Editor would potentially have to remove lines of code from other files in the module.

Another concern is any remaining references to the class that is being deleted. References in a uasset file (such as a Blueprint) can be flagged by the Editor to let you know that they will need to be corrected. However, any code references to the class will not be found until a build is initiated after the class is deleted. Once a broken code reference looking for the deleted class is found in the build, the project is essentially broken until you manually correct any remaining broken code references.

While it may be theoretically possible to implement a feature allowing a code class to be deleted from the Editor, it would be a very large task to implement an automated system we would not be able to guarantee would work in all situations. The truly unfortunate side effect to this system would be that we would not be able to verify whether the code class was deleted successfully until after it was deleted. The first indication of a problem would likely be when the subsequent build fails. Depending on a user’s setup, this may not be something they could recover from.

This is why I love unreal. The power we get has a reality to it. You can’t have a powerful tool without inherent difficulty else it wouldn’t be powerful.

When delete is used to deallocate memory for a C++ class object, the object’s destructor is called before the object’s memory is deallocated (if the object has a destructor). If the operand to the delete operator is a modifiable l-value, its value is undefined after the mcdvoice object is deleted.

When delete is used to deallocate memory for a C++ class object, the object’s destructor is called before the object’s memory is deallocated (if the object has a destructor). If the operand to the delete operator is a modifiable l-value, its value is undefined after the object is deleted.