i have a small Problem. In my game i made a custom game instance. This instance is in C++. Then i made from this instance a BlueprintInstance to save values in. This values i use to load at the Level changing.
In the Editor or the standalone mode all works perfect. But if i build a packaged game and Play it, nothing is saved and loaded.
I changed the game instance under Project Settings->modes and maps (?).
In the DefaultEngine.ini it is changed lik this:
I ran some tests with a new project made in 4.10 and, as you noted, I did not see any problems with a custom Game Instance class not being used in that case. Do you still see the same issue happen in 4.12? If so, would it be possible to get a copy of your project to try to determine why this is happening there?
I tested everything and made almost 8 Packaged games. Now i have a solution. It is wierd. If i set in my blueprint a delay (5 seconds) to read from the blueprint after the game starts, then all is working just fine.
My variables are in my Playerblueprint. From that i sent These vars to the gameinstance. After i Change the Level i read them back to the Player. Like i said: in the Editor it worked. I dont know whats wrong. Maybe i did something wrong, but now it is working.
I dont tested 4.12 yet, because i want first to finish my Project. But thank you for looking at my Problem.
To be sure i made a bool for every Level. Let’s say, if Level 1 true, then save the vars in the gameinstance and update it every 2 or 3 seconds. In the begin Play from my Player i read the first bool from level1. If this bool is true then load the vars. If this is false, then do nothing and wait till Level1 is true. It’s a Little bit strange, but it works ;o)
Would it be possible to get a screenshot of where you are sending the variable information to/from your GameInstance blueprint? I think I may have an idea of what is happening here, but I’d like to see exactly how you have it set up to make sure.
Here is a overview from my character blueprint. In the upper left Corner i marked the Settings for the game instance. The first one is called by Event begin Play. Here i check if the first Level is passed. If not, then i set it to passed and the second box is called (from begin Play too).
The second box cast to the gameinstance and set the variables back to my character.
The third box cast to the gameinstance and set the variables i want to use later. I set the vars every second. I tryed every 5 seconds too.
Only with the delay in 3.png loading from gameinstance works. Maybe i missed something.
Thanks for providing the screenshots. I tried again to reproduce the issue using a setup as close as possible to what you are using (without the delay), and again saw no problems with the GameInstance in a packaged game.
I had initially thought that you may be trying to use GameInstance to access data from the Character before the character is actually created, but I no longer think that is the case after seeing what you are doing. I’ll need to poke at this some more next week.
So far I have been unable to reproduce the issue that you described. However, I did have a chance to discuss the issue with a coworker and he brought me back to my original suspicion that either the GameInstance or the Character were not loaded yet when the attempt was made to transfer data from one to the other. The Engine does not guarantee the order in which elements will be loaded when the game begin, and the fact that adding a brief delay allows everything to work for you seems to point in this direction.
In the setup that I was testing, it seems like the various elements of the game were all loading in an order that allowed me to get by without a delay, but any time you are referring to another Blueprint or class at the very beginning of the game, it is usually a good idea to provide a brief delay to make sure everything is fully loaded.