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.
Select Edit|Project Settings.
Set Game Instance to your Blueprint created in step 1.
Select File|Package Project|Windows|Windows 64 bit. Clear the “Use Pak File” option.
When packaging is complete, go to coooked asset folder where blueprint from step 1 should be.
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;
Launched 4.5.1 Binary
Created a new C++ First Person project
Created a new GameInstance Blueprint
Project Settings > Maps & Modes > Game Instance Class > NewGameInstance
Made a copy of Example_Map
Saved copy as test.umap
Opened DefaultEditor.ini
Pasted [AllMaps] +Map=/Game/Maps/test
Saved DefaultEditor.ini
Disabled Use Pak File
File > Package Project > Windows > Windows (64 bit)
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 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!
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!
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.
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!