Blueprint Widget Reparenting

Is there a way to move the parent class of a Widget blueprint, without having to re-create the widget manually from scratch?

Re-creating all the child widgets, with their styling options, as well as all the blueprints events needed by the widget, functions and variables, especially when working with a list view, can take hours.

Also, the broken widget ( which parent got moved ) won’t open in the Editor, so Copy and Paste from it is not an option. I guess if we copied the widget and its parent class, instead of moving them, at least we could Copy and Paste blueprint nodes from the original, and delete it later…

Same question for Data assets. We ran into the same issue for Data Asset with a C++ parent class.

If we had to migrate only 1 widget, it wouldn’t be too big of a deal. But as part of a refactoring effort, we are moving many classes to different folders. So I am hoping there is a way to avoid re-creating 5 to 10 complex widgets manually.

Steps to Reproduce
In C++ create a class inheriting UserWidget, let’s call it MyWidgetBase.

In the the Editor, create a Widget Blueprint under the User Interface menu, let’s call it MyWidget, set the parent as MyWidgetBase

In the Designer view, create an entire Modal with Buttons, text boxes and layouts. In the graph view define all the logic needed for that widget.

All good so far.

Now in your IDE, move MyWidgetBase to a different folder ( maybe we have decided to move the base class and the Widget blueprint to a plugin ).

Now in the Editor, when you try to open MyWidget for Edit, an error pops up, complaining about its parent not being found. And the re-parent option is not available.

At this point you have to re-create MyWidget from scratch.

Hi [mention removed]​,

When you move the location of a file or a class, Unreal Engine is unable to get the new location of the assets. Depending on the operation, Unreal can be able to find the new location of the asset, but normally, when C++ files are just moved from their original location and more to another module like a plugin, Unreal has difficulties linking them again.

That is why Unreal has the engine redirectors. This concept was created to tell unreal what class we are trying to reference and where it is now. These redirectors can be set directly inside the DefaultEngine.ini file or the plugin .ini file.

Example:

+ClassRedirects=(OldName="/Script/TPP_533.MyWidgetBase",NewName="/Script/MyWidgetsPLugin.MyWidgetBase")

In this case are telling the engine that inside the Source(Script) folder, inside the module TPP_533 we are creating a Redirect of the class MyWidgetBase. We are redirecting it to the Source(Script) folder, inside the module MyWidgetsPlugin and to the MyWidgetBase class.

Once this is said, it is recommended to delete the Binaries, Intermediate, and Saved folders and regenerate them with the Generate Visual Studio Files option in the .uproject.

Once opened, you need to also Right Click your asset -> Asset Actions -> Reload. This should be done by the engine but sometimes if you have any issues you can try to reload it manually. In my case I did the repro project you mentioned, I was able to trigger the issue and I could solving by reproducing these steps.

Let me know if it did the job.

Best,

Joan

Hi Joan,

Thank you for the suggestion! I just tried it in a test project, and it works as expected :raising_hands:

That’s a great tip that will save us hours of laborious work. Thank you!

Isabelle & team

Happy to help [mention removed]​

Will close the case for now. Feel free to open it again if you have any doubts.

Best,

Joan