References to blank GameInstance blueprint causes crash while running cooked assets

  1. Create a blueprint with a baseclass of GameInstance. In my specific case it was a c++ class derived from GameInstance, but I think results would be same. Don’t add anything to blueprint.
  2. Select Edit|Project Settings.
  3. Set Game Instance to your Blueprint created in step 1.
  4. Select File|Package Project|Windows|Windows 64 bit. Clear the “Use Pak File” option.
  5. When packaging is complete, go to coooked asset folder where blueprint from step 1 should be.
  6. Notice blueprint uasset is missing.
  7. Notice that running game will crash.

Expected:
Empty blueprints are still cooked.

Hey

I wasn’t able to reproduce this issue. I attempted creating a new GameInstance blueprint, a new GameInstance class, and a new blueprint derived from new GameInstance class, and in all cases game did not crash. Can you attach crash log and dump file from project after this crash?

If you are only using a C++ class derived from GameInstance, it won’t show up in Saved > Cooked. If you create a BP derived from your GameInstance class, that should show up as expected. Let me know if that’s not happening.

In order to reintroduce crash, all I needed to do was step 2 and repackage. Launching game into my world produced crash. Forgot to mention before, this is with local 4.5 source, but I don’t think any of my engine edits would coincide with this crash. I have attached log and dmp file.link text

I was not able to reproduce this in 4.5.0 or 4.5.1, so it may be related to a change you made to source or it may be related to something else in your project. To test this, create a new project, add GameInstance using same steps, and package/run project.

Just to check: is game crashing, or editor? If it’s game, does it crash immediately or does it first load map?

I think I’ve narrowed down repro. I tried creating a new C++ project from stock 4.5.1 engine. I then did steps 1-3. Now add these steps:

  • 3 . 1 Copy MyGame\Content\Maps\Example_Map.umap to MyGame\Content\Maps\test.umap
  • 3 . 2. Go to MyGame\Config folder and edit DefaultEditor.ini.
  • 3 . 3. To force cook specific maps, add these lines to DefaultEditor.ini

[AllMaps]
+Map=/Game/Maps/test

It appears that telling packaging to cook a specific map will force it to miss GameInstance blueprint created in step 1. I had found this [allmaps] technique of specifying what maps to cook somewhere within forums. I definitely don’t want to cook all my maps if I don’t need to, so this is an important feature for me to use. I skipped specifying a few steps in repro, but I’m pretty sure they are not needed. steps were making c++ classes and blueprints for gamemode and gamestate.

I still am not getting game to crash. Here are steps I took; please let me know where I did something different than you;

  1. Launched 4.5.1 Binary
  2. Created a new C++ First Person project
  3. Created a new GameInstance Blueprint
  4. Project Settings > Maps & Modes > Game Instance Class > NewGameInstance
  5. Made a copy of Example_Map
  6. Saved copy as test.umap
  7. Opened DefaultEditor.ini
  8. Pasted [AllMaps] +Map=/Game/Maps/test
  9. Saved DefaultEditor.ini
  10. Disabled Use Pak File
  11. File > Package Project > Windows > Windows (64 bit)
  12. Run Binary

Are there any key steps I’m missing to reproduce behavior you’re seeing? packaged game runs fine for me, and I’ve tried a number of variations on this (including attempting this in a source build). If I haven’t missed anything, would you mind uploading test project you reproduced this in somewhere and giving me a link? Thanks!

Thanks for sticking with this ! Hopefully your suggestion on me providing a sample will do trick.

Steps:

  1. Install UE4 4.5.1
  2. Download GameInstanceTest. from https://onedrive.live.com/redir?resid=71ADCADD1B26EC92!2295&authkey=!AFfZnysKyK2j7RA&ithint=file%2czip
  3. Unzip archive to /GameInstanceTest
  4. Select GameInstanceTest.uproject and select Switch Engine Version and select 4.5
  5. Generate Visual Studio Project files
  6. Compile project with Development Editor|Windows build target
  7. Run editor. I just hit F5 after build was done.
  8. Select File|Package Project|Windows>Windows (64 bit)
  9. Package to /Packaged
  10. Notice /Packaged/WindowsNoEditor/GameIntanceTest/Content/Blueprints/ is missing a MyGameInstanceBP.uasset
  11. Run /Packaged/WindowsNoEditor/GameIntanceTest/Binaries/Win64/GameIntanceTest.exe.
  12. Notice crash
  13. Run /Packaged/WindowsNoEditor/GameIntanceTest/Binaries/Win64/GameIntanceTest.exe Example_Map
  14. Notice crash

Hey

Thanks for test project! I was able to reproduce error, and determined that cause of issue is the +Map=/Game/Maps/test edit to DefaultEditor.ini. For some reason, this is causing packaged game to not include custom GameInstance. I am conferring with our packaging developers to see how they want to handle it, and I will let you know if we enter a bug report or find a workaround for you. In meantime, packaging without that DefaultEditor edit will allow you to play game. Thanks again for report!

Any news on that, we are having same issue…

Hi ,

Sorry for delay! This has been a hard one to track down. We believe we have a fix in an upcoming internal build (CL-2399946), but we still need to verify it. I will post an update here when I have one. Thanks for your patience!

Hi everyone,

I am using a workaround right now: Just add directory where your custom GameInstance blueprint is located to DirectoriesToAlwaysCook. This ensures that blueprint is cooked and prevents crash.

DirectoriesToAlwaysCook is located in DefaultGame.ini under [/Script/UnrealEd.ProjectPackagingSettings] or just use Editor (Project Settings, then Packaging, show advanced settings for Packaging and then add your directory.

Hope it helps

Hi all,

I tested this again in 4.7.2 and it appears to be working properly. If you upgrade your project to 4.7.2 and still experience this issue, please let us know. Thanks!