Renaming C++ Class

I have this UObject derived C++ class UMyClass that I have to rename. The problem is that I’m referencing it many times in Blueprints, GUI widgets to be precise. Without redirecting to the new class, I will have to spend hours to fix all the errors and replace nodes and variable types. I googled the problem and learned that there should be a solution that requires me to edit the DefaultEngine.ini under [/Script/Engine.Engine].

I tried

+ActiveClassRedirects=(OldClassName=”UMyClass”,NewClassName=”UMyNewClass”)

+ActiveClassRedirects=(OldClassName=”My Class”,NewClassName=”My New Class”)

+ActiveClassRedirects=(OldClassName=”UMyClass”,NewClassName=”/Script/Project.UMyNewClass”)

+ActiveClassRedirects=(OldClassName=”MyClass”,NewClassName=”/Script/Project.MyNewClass”)

Nothing works. Everytime I restart the editor (I’m not saving the widget classes ofc), a variable that used to be of type UMyClass becomes UObject, not UMyNewClass. I also tried both keeping and removing the old class before starting.

What am I doing wrong?

the correct one is

+ActiveClassRedirects=(OldClassName=”MyClass”,NewClassName=”/Script/Project.MyNewClass”)

it should have worked… try again maybe ? :confused:
was the class defined in a pluggin ?
try with ‘/Script/Project/’ for the oldclassName aswell, but it worked without it on my project

if you keep the old class, does the type of the variable in blueprint still good or already as a UObject ? ( maybe the problem is somewhere else )

Thanks for the quick response. In the meantime I tried this new system under Engine.ini [CoreRedirects], that I just read about, but also without success.

No plugins - I’ve got everything in a single project/module. Code is organized in folders, but if my intuition doesn’t deceive me here (in lack of technical understanding…), that shouldn’t make a difference.

I did like you said and added the “/Script/Project.” to the old class name as well and that did the trick! Thanks a lot, saved me a lot of pointless experimenting :slight_smile:

To validate the answer for futur users looking for this ( and close the question )

the solution was :
+ActiveClassRedirects=(OldClassName=”/Script/Project.MyClass”,NewClassName=”/Script/Project.MyNewClass”)

Two small clarifications this answer (because they were points of confusion to me when I tried this).

  1. In the example, the word “Project” should be changed to the actual name of your project.
  2. In the C++ code, the class names would have a prefix like UMyClass and UMyNewClass. But you need to drop the U prefix in what you put in the file.

It’s far from the best solution, but I just leave it here.

  1. Create “MyNewClass” class in file that contain “MyClass” :

    UCLASS()
    class PROJECT_API AMyNewClass : public AActor
    {
    GENERATED_BODY()
    };

  2. Build solution.

  3. Go to UE editor and reparent your blueprint to your new empty class with new name

  4. Go back to code, remove empty class you’ve just created, rename your target class.

  5. Build solution.

It helps me for small Actor based class