Migrating Blueprints Based on Migrated C++ Code: Bluprint could not be loaded because it derives from an invalid class. Check to make sure the parent class for this blueprint hasn't been removed!

So I migrated some C++ code from an old project to my Labratory “test” project by copying, pasting and a bit of header file renaming (replacing #include for old project header w/ new one, etc.).

The migration of the C++ classes appears to have been successful; however, following the code class migration I also tried to migrate a blueprint based on the migrated class using the UAsset Migrate functionality of the engine. This blueprint now cannot be placed in the level and gives me the following message when I try to edit it:

“Blueprint could not be loaded because it derives from an invalid class. Check to make sure the parent class for this blueprint hasn’t been removed!”

The parent of the BP is set to none, even though the proper parent class is now in the new project. Is there a way that I can re-parent this BP to the intended parent class in the new project without opening the BP editor (which I cannot do, due to the aforementioned error?)

Hi! Seasoned game programmer who’s recently moved to UE5 here!

I’ve made a project with C++ classes, and Blueprints which are parented to those C++ classes in a little engine test project (RPGRulesCpp). I then wanted to migrate all of this to a game project (AdvMOBA). It was all a bit of a runaround. :slight_smile:

Here’s what I ended up doing:

  1. Copy the cpp and h file folders over in Windows Explorer, and then rebuild AdvMOBA.sln from AdvMOBA.uproject. (Also had to update the AdvMOBA.Build.CS file to add modules I’d been using in the source project) This did not build.
  2. Do a Find and Replace in Files for the module name so that the project would compile. (in my case replace all RPGRULESCPP_API with ADV_MOBA_API). The project now compiles and builds!
  3. Open RPGRulesCPP in the editor and use the Migrate tool to copy all my blueprints across to AdvMOBA. This worked OK.
  4. Open AdvMOBA in the editor. When I try to open any of the blueprints it says it cannot find the parent class… (and doesn’t say what the missing parent class is called)
  5. Open up AdvMOBA/Config/DefaultEngine.ini and add a line for each C++ class that will either be a Blueprint parent, an ActorComponent, or a UDataAsset. Like this… each one redirecting from the old module name to the new module name. I had to add about 30 cases like this, one for every C++ class in these categories!

[/Script/Engine.Engine]
+ActiveGameNameRedirects=(OldGameName=“/Script/RPGRulesCPP.RPGBrain”,NewGameName=“/Script/ADV_MOBA.RPGBrain”)
+ActiveGameNameRedirects=(OldGameName=“/Script/RPGRulesCPP.AnimatedAction”,NewGameName=“/Script/ADV_MOBA.AnimatedAction”)
+ActiveGameNameRedirects=(OldGameName=“/Script/RPGRulesCPP.BillBoarder”,NewGameName=“/Script/ADV_MOBA.BillBoarder”)

I can now open my blueprints in the new project, and see everything behaving correctly. Yay!

My question as a Unreal newbie is - is there a smoother way of doing this?

2 Likes

Use a Core redirect using MatchSubString modifier to map all items from one name to another:

[CoreRedirects]
+ClassRedirects=(OldName=“/Script/RPGRulesCPP”,NewName=“/Script/ADV_MOBA”,MatchSubstring=true)

2 Likes

so this… IS the way? Is there any potential downfall to this type of thing?