Download

Delete C++ Classes

Hi,
would like to remove some redundant code, whats the right was to remove c++ files from unreal projects. Also how about moving c and h files.
reply,
Boldbod.

I’ve found the easiest way is to physically move and/or delete the .h or .cpp files themselves in the folders then run Right Click > Generate Project Files on the .uproject file and it will rebuild your solution with everything in the correct new place in Visual Studio.

Hi Dec1234,
Thank you for reply. I have a question, if we deleted the cpp classes of actors, and if there are some visually scripted blueprints derived from those cpp classes actors, then how will they be updated. Like will they get deleted or marked as bad assets.
Reply,
BoldBod.

I thinkthey will throw a bunch of errors or warnings then revert to AActor? I can’t be certain of this. It might be better to go and change the base class of each of those blueprints before you delete. You can also add an ActiveClassRedirects to your .INI files to make a class path point and reference a new class in case it’s ever deleted or renamed.

It looks something like this when added to your DefaultEngine.ini:



[/Script/Engine.Engine]
 +ActiveGameNameRedirects=(OldGameName="TP_Flying",NewGameName="/Script/Flying")

When i deleted C++ Classes from which Blueprints derived they got “unopenable” (is this actually a word?). So as Dec1234 redirect the Blueprints or delete them, reparenting doesn’t work after deleting the C++ Baseclass.

@ExCluSiv3 : before deleting C++ classes you must make sure they have no dependencies. You can use the Reference Viewer in the UE Editor to make sure of this.
Anyhow it should be easier (and safer) to delete/rename C++ classes, still nothing new in this area in 4.16…

Unreal Engine provides great rendering, but it’s a shame that the editor has a lot of immaturity.

It’s awful that we can’t delete c++ class from the content browser.

If they can’t implement a feature to the editor, they must indicate “what editor need and not”, and add “removal procedure” to the manual.

We can easily predict that these low-level removal steps could break the project

1 Like