Blueprint Widget Parent Class: None

I made the mistake of deleting a Parent Blueprint Widget Class (a parent class for most all of my UI Widgets), now I am unable to open my UI Widgets in the Editor to change the parent class of those widgets to a new parent class.

I have lost a couple months of work due to this simple mistake.

I cannot find a way in or out of editor to change the parent class for any widgets that used the parent class.

Looking like I am going to have to redo a couple months of work?..this seems pretty stupid to me (I am aware it was a stupid mistake to begin with). I just cant believe the editor couln’t replace code in the blueprint to a base user widget class for the parent class for these widgets so i can then change the parent class??

The issue could also be that if you were to restore/reconstruct it, the references to it and its children would also be obliterated or corrupt. And you’d have to painstakingly make sure that all references are intact.

What a mess.

I hope you have backup versions that you saved.

Moving forward, I would ZIP stable versions of your project:

If you do not have backup versions, you’ll need to reconstruct the parent class (I know you know this), but I’m rooting for someone here that may know an elegant or hacky way to assist you.

Good luck.

I…do not have backups lol. I dont know how I never noticed the ZIP Project option. I used to have a copy of project folder for backup, but that just got messy. Live and learn.

As far as references and rebuilding it, the Parent class just had two or three variables to set references to Game Instance, Game Mode and HUD. I could rebuild the parent class easily. The child widgets not so easily.

If I could just somehow set the parent class to User Widget and Open the Blueprint, I could EASILY fix my problem without having to rebuild manually all the child widgets.

I’ve had this experience as well, and unfortunately, I was in a situation where I had already deleted the Saved folder, so I didn’t even have any backup files.

My solution was to temporarily modify the engine source file to force the corrupted Widget Blueprint to open. After opening it, I copied all the widget elements and pasted them into a new, clean Widget Blueprint.

This method seems very risky, but it works well for the purpose of opening the widget ‘just once’ to recover your work.

Hope this helps!

P.S. After you’ve recovered your widget, you absolutely must revert the engine code to its original state and rebuild the engine.

// The following is a modification of the engine source code in UAssetDefinition_WidgetBlueprint.cpp

EAssetCommandResult UAssetDefinition_WidgetBlueprint::OpenAssets(const FAssetOpenArgs& OpenArgs) const
{
EToolkitMode::Type Mode = OpenArgs.GetToolkitMode();

EAssetCommandResult Result = EAssetCommandResult::Unhandled;

for (UBlueprint* Blueprint : OpenArgs.LoadObjects<UBlueprint>())
{
   if (Blueprint && Blueprint->SkeletonGeneratedClass && Blueprint->GeneratedClass)
   {
      TSharedRef<FWidgetBlueprintEditor> NewBlueprintEditor(new FWidgetBlueprintEditor);

      const bool bShouldOpenInDefaultsMode = false;
      TArray<UBlueprint*> Blueprints;
      Blueprints.Add(Blueprint);

      NewBlueprintEditor->InitWidgetBlueprintEditor(Mode, OpenArgs.ToolkitHost, Blueprints, bShouldOpenInDefaultsMode);
   }
   else
   {
      // Modify Here
      // Forcefully set the parent and generated classes to UUserWidget to open the corrupted asset.
      Blueprint->GeneratedClass = UUserWidget::StaticClass();
      Blueprint->ParentClass = UUserWidget::StaticClass();

      TSharedRef<FWidgetBlueprintEditor> NewBlueprintEditor(new FWidgetBlueprintEditor);

      const bool bShouldOpenInDefaultsMode = false;
      TArray<UBlueprint*> Blueprints;
      Blueprints.Add(Blueprint);

      NewBlueprintEditor->InitWidgetBlueprintEditor(Mode, OpenArgs.ToolkitHost, Blueprints, bShouldOpenInDefaultsMode);

      // I commented out the original error message dialog.
      // FMessageDialog::Open( EAppMsgType::Ok, LOCTEXT("FailedToLoadWidgetBlueprint", "Widget Blueprint could not be loaded because it derives from an invalid class.\nCheck to make sure the parent class for this blueprint hasn't been removed!"));
   }

   Result = EAssetCommandResult::Handled;
}

return Result;

}

i believe you can just create a new c++ class with the same name, leave it empty and it should at least allow you to open your bp classes and reparent.