x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

Custom Game Instance dont work in Shipping Build

Hi there,

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:

 [/Script/EngineSettings.GameMapsSettings]
 GlobalDefaultGameMode=/Game/SideScrollerBP/NewGameMode.NewGameMode_C
 GameInstanceClass=/Game/BrainInstance_BP.BrainInstance_BP_C
 GameDefaultMap=/Game/Maps/MainMenu
 EditorStartupMap=/Game/SideScrollerBP/Maps/SideScrollerExampleMap
 TransitionMap=/Game/Maps/TransLevel


What's wrong? Why does it work in Editor and standalone but not in the packaged build? Can anyone help me out with this?

Greetings Beregron

Product Version: UE 4.10
Tags:
more ▼

asked Apr 26 '16 at 01:55 PM in Packaging & Deployment

avatar image

Beregron
318 8 13 19

avatar image Beregron Apr 27 '16 at 05:21 PM

I've made a new blank c++ Project and made the GameInstance in the same way. First as c++ with functions. Then from this i made a blueprint. I set the blueprint as the gameinstance.

With this packaged testgame all works just fine. I dont understand why it doesn't work with my game.

I thought there was a Problem with a plug in. But in the testgame it works; with the plugins.

Have anyone an idea what cause the Problem? Or is it maybe a bug?

avatar image Tim C ♦♦ STAFF May 03 '16 at 03:11 PM

Hi Beregron,

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?

Tim

avatar image Beregron May 06 '16 at 08:39 PM

Hi Tim,

sorry for the Long delay....

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.

Beregron

EDIT say: 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)

avatar image Tim C ♦♦ STAFF May 09 '16 at 06:35 PM

Hi Beregron,

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.

Tim

avatar image Beregron May 10 '16 at 06:32 PM

Hi Tim,

here are the Screens.

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. alt text

alt text

alt text

alt text

1.png (551.1 kB)
2.png (413.0 kB)
3.png (422.1 kB)
4.png (229.3 kB)
avatar image Tim C ♦♦ STAFF May 13 '16 at 08:33 PM

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.

Tim

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

Hi Beregron,

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.

Tim

more ▼

answered May 18 '16 at 04:15 PM

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question