BP loses its parent C++ class after re-opening the editor.

Hello, I’ve just started the UE5 course: Code a First-Person Adventure Game, in the first part, you make Game mode class and then create a BP from it. The issue I have is when you re-open the editor, the BP loses its parent class and the gamemode override (world setting) is set to none. Even in the “Project Settings” → “Maps & Modes” → “Default Gamemode” , it is set to none, you cannot find the BP in the list either, even when you first create it. Live coding is disabled and have tried closing the editor → building in VS and re-opening and refershing VS. Nothing I’ve tried seems to work.

Wondering if anyone else has encountered this problem? From my test, it seems to have come from the first-person template, since I made another project in third person, everything seems to be fine.

Close the Editor
Open your project folder and delete the following files and folders.

Re-Generate VS projectile files.

Open your project in VS by using the new .sln file.

Build Solution

Close Visual Studio and launch your project.

If prompted to rebuild modules, then do so.

Thanks for the reply, the above did not work. I deleted the project with the issue, but was able to recreate it again as I’ve done it a few times whilst trying to solve it myself.

I thought I give a more step by step of what I did to make it easier to replicate the issue.

  1. Made new project, First PersonBlueprintCreate

  2. Created a new game mode: ToolsNew C++ classGame Mode BaseCreate Class

  3. I get two pop ups, first one stating that the project includes sources and to close the editor and build from the IDE. The second one is the class has been made successfully but you need to recompile and asks if you want to edit the code now. I press yes, after couple of tests with no, this issue remains the same.

  4. I close the editor and build from the VS.

  5. Launch EditorC++ Classes(Project Name)Right click the game modeCreate blueprint class based on gamemodeRename BP_MyGameModeBaseselected destination to be in: First PersonBluePrintsCreate My Game Mode bas…

  6. Ctrl + Shift + S to save all

In the world settings, the BP will not appear in there, but you can drag or “Use Selected Asset from Content Browser” and the BP will be there.

NOTE: When trying to change the “GameMode Override” in the world setting, you will not find the BP in the list however you can drag the BP into it, but when you relaunch, I was presented with error messages:

CreateExport: Failed to load Outer for resource ‘DefaultSceneRoot_GEN_VARIABLE’: BlueprintGeneratedClass /Game/FirstPerson/Blueprints/BP_MyGameModeBasetest.BP_MyGameModeBasetest_C

CreateExport: Failed to load Outer for resource ‘SimpleConstructionScript_0’: BlueprintGeneratedClass /Game/FirstPerson/Blueprints/BP_MyGameModeBasetest.BP_MyGameModeBasetest_C

CreateExport: Failed to load Outer for resource ‘SCS_Node_0’: SimpleConstructionScript /Game/FirstPerson/Blueprints/BP_MyGameModeBasetest.BP_MyGameModeBasetest_C:SimpleConstructionScript_0


  1. Reopen the Editor and hover over the BP:

Note: I have also close the editor and built, the issue is still the same. Another thing to keep in mind, when re-launching the editor and hovering over the BP, you will see the parent class filled, after some time it will go or if you try to open it, you will get prompted this error message:

“Blueprint could not be loaded because it derives from an invalid class…”

  1. Close both VS and Editor and tried your steps.

TLDR:
Created a new gamemode on a fresh project (First Person), issue remains still.
I’m able to create a BP from the C++ class and add it to the gamemode override by dragging or using the arrow.
Upon relaunching editor, I’m presented with errors:

CreateExport: Failed to load Outer for resource ‘DefaultSceneRoot_GEN_VARIABLE’: BlueprintGeneratedClass /Game/FirstPerson/Blueprints/BP_MyGameModeBasetest.BP_MyGameModeBasetest_C

CreateExport: Failed to load Outer for resource ‘SimpleConstructionScript_0’: BlueprintGeneratedClass /Game/FirstPerson/Blueprints/BP_MyGameModeBasetest.BP_MyGameModeBasetest_C

CreateExport: Failed to load Outer for resource ‘SCS_Node_0’: SimpleConstructionScript /Game/FirstPerson/Blueprints/BP_MyGameModeBasetest.BP_MyGameModeBasetest_C:SimpleConstructionScript_0

and when opening the BP, I get this message:
Blueprint could not be loaded because it derives from an invalid class…

and the game mode override (world setting) is set to none.


This could be an issue with my machine and possibly need to reinstall both VS and UE5 just to be on the safe side, however, I’ve replicated these steps on third person, and it works perfectly fine.

I hope this explains my issue.

Thanks.

Note: I had multiple screenshots, but I can only put in one currently.

General process is:

  1. Tools → Create New C++ class.

  1. Live coding will boot and hot compile in the editor.

  1. VS will boot and generate the .h and .cpp AND typically prompts to Reload the project from disk.
    Press Reload All.

  1. Closed UE Editor, Then Build solution in VS.

The Output pane should note BUILD: n succeeded, 0 failed etc.

  1. Close VS.

  2. Open Project in UE Editor. Attempt to create a BP with your new class as parent.

Once you create the new BP, save the file, then close the project and restart it.

Verify the BP parent is valid.


IF your new class isn’t listed

Close UE editor
Delete the .VS, Binaries and Intermediate folders, then regenerate the VS project files.

Once generated, Launch the project in VS and Build solution again. Then, Jump to Step 5.

I launch from the .uproject file.

If you get prompted to rebuild modules, click Yes.

Your Class should now be available.

1 Like

Thanks for the reply, I tried the following steps and I still have the issue. I have reinstalled UE5 and VS and tried again but the problem still persists. I have noticed that when I create a C++ class I get a different icon compared to what you have. It should be a Console controller thumbnail but instead I just get a C++ Class. Even the BP has a thumbnail of Blueprint Class. On my third person template, I have the same thumbnail as you and I’m assuming something is not loading correctly but its strange for it to happen only on the First person template.

As you can see that the GM_FirstPerson is what it should look like. Any classes that look like BP_MyGameMode or MyGameModeBase thumbnail will throw an error/loses parent class upon restarting. No errors when compiling apart from the errors that I’ve mention in the past when starting the editor with the BP as the default gameworld override.

I’ve just done another test on the third person to see if reinstalling caused any issues on that but this is working normally still.

Tried the same on a blank level and it works perfectly fine.

I’m guessing not many people are having this issue, I can always not use the First person template. But I do find it strange that it happens only on that. If you have anything else for me to try I’d be happy to do that, otherwise I appreciate the time and effort in the replies. :slight_smile:

When you create your project are doing BP or C++?

You should be doing C++, regardless that you can add C++ to BP.

Best approach is to use a Blank C++, then Add the content you want. I find adding the BP FP/TP content works best.

Every one of my primary core classes derives from a custom C++ class.
I create them all on first boot. Then create the BP’s after building solution.


My Character class derives from a C++ extended class. I import the TP Character content, then reparent the character to use the custom.

I have been picking BP instead of C++ as the tutorial specifies. I have tried the method you’ve outlined and it works perfectly fine. I will most likely go forward doing this, I remember seeing similar steps on a tutorial by starting off on a blank and Add Feature or Content Pack. I’ve even tried FP C++ and it works. Looks like FP with BP has the issue for me, everything else seems to work just fine.

Thank you so much for the help.

:+1:

Best practice is to go ahead and create a C++ class for all your core classes.

Core classes are defined in the Game Mode. GM → Class Defaults → Classes
At some point you’ll probably need to modify/add C++ to these classes prior to publishing. C++ is also more robust. You can do more in C++ than in BP.

1 Like

This URL perfectly solves your issue: https://forums.unrealengine.com/t/i-am-unable-to-make-my-c-classes-survive-a-restart-in-unreal-5-6/2560725/8?u=hbbbs