Is deleting a class ever going to be easier?

Hello,

I’m new to this community (and UE4 in general) and I’ve spent the last few hours reading various posts on how Unreal interacts with C++. My question (as the title says) is if deleting/renaming a class ever going to be easier.

I know that with a little more research I may find the answer to this, or at the very least, a vague roadmap. Anyway, I thought it’d be better if I just ask away!

So, if anyone knows or could point me in the right direction, it would be much appreciated!

Thanks a lot.

Hey.

What is the issue you’re having with deleting/renaming classes?

Both cases (assuming you remove one class and create another one to replace it) can be solved by UE’s redirectors. Actually same goes for function names, params, structs, enums etc.

Right now my workflow for deleting/renaming C++ is:

  • Copy C++ class and rename it
  • Move the old class out of the project, to a backup folder
  • Build C++ code
  • Reparent blueprints that derived from the original C++, to derive from the new/renamed C++ class
  • Clean project (Intermediates, .vs, etc…) and regenerate/rebuild everything

I thought redirectors work only with blueprints and assets. Isn’t that the case?

Okay I’ll try renaming with redirectors next time. However, how are redirectors going to help if I’m trying to delete a C++ class that has a blueprint deriving from it?

Is UE going to warn me before deleting it? Like when I try to delete a texture that is referenced in a material for example.

If you delete class for a blueprint, you might probably break it and make unsuable.
You could try setting up redirector to AActor/UActorComponent/UObject (depending on your case) so in such circumstance you might save yourself some time and work. But after doing such thing blueprint probably will end up with compilation errors.

If you actually do want to remove class and all its blueprints, I’d go for deleting blueprints first. I did enounter an error couple time that was causing that even selecting blueprint with deleted class was resulting in crash. I had to remove files from window’s File Explorer level.

If you remove class from VS UE4 won’t know about it until you’d try to compile it. So it won’t be able to warn you about doing such thing.

Well, redirectors are for engine assets, yes. But at least instead of having to reparent every class on your own, replace function calls, blueprint properties etc, you can automate that with redirectors. In fact, whenever new version of UE comes out, there’s lots of redirectors added to do stuff like that. See here. Project-related redirectors should go to ProjectName/Config/DefaultEngine.ini

As for renaming class in VS, you could use VAX. It has great refactoring tools, that automatically update all references of renamed class. It sometimes rename file name as well, but I’m not sure why it doesn’t work all the time. :stuck_out_tongue:

After doing this you’d have to regenerate project anyway tho. (and in rare cases remove intermediates too)

Okay thanks for the info you provided. It’s really helpful! However, don’t you think that’s a lot of trouble to just delete/rename a class? :stuck_out_tongue:

I mean… That’s something I’d expect to be able to do by simply renaming it. No risk to break anything, no setting up redirectors, nothing. Hence the title, Is it ever going to be any easier :slight_smile:

Yeah, it is a minor hassle. I guess I just got used to it. I don’t think this pipeline would be improved any time soon (if at all).

Improvement you’re wishing for doesn’t even seem possible to me, actually. Realistically, I mean. Engine would have to have some external tool that runs in the background even when engine is turned off. And that would have to run for every project you might have launched at given time. It would have to scan your files and see what changes you’re doing and then prepare some kind of dynamic redirectors while compiling/starting your project.

@Down:
Yw, and have a nice day as well! :stuck_out_tongue:

All right. I guess I’ll have to get used to it as well!! Thank you for your time :slight_smile: Have a nice day