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"

GameInstance variables invalid at OnPostLogin... unless delayed?

I'd been trying to chase a bug in my code thinking I was misunderstanding fundemental aspects of replication... but further testing revealed something peculiar about the timing and availability of GameInstance when going into a lobby level and waiting for Event OnPostLogin from the serving player (I think.)

Bear with me, I'm new at this...

I have an inherited GameInstance object that is storing some variables for 3D UI actors. Using getter functions my PlayerController object can find a specific user widget and communicate with it.

I have a GameMode object, properly configured, that OnPostLogin, calls a test event the New Player, set to Run on Client. This event gets the GameInstance (casted) and gets the variable that holds the reference to the 3D UI actor.

Here is the basic chain of BP: alt text

alt text

The Print String for GetGameInfoInstance returns a proper display name (the casting occurs in the function), but the following variable get returns invalid. I've tested this with IsValid checks as well.

But if I put even a zero length delay in EITHER the OnPostLogin event or the Test Event as in one of these images: alt text alt text

Then GameInstance variables return as expected.

I just need to know why this is happening? Do I need these arbitrary Delays in my BP functions or am I simply doing this wrong? It's my understanding that GameInstance is persistent across levels, and so I am using it to store access to these client 3D UI actors. Ultimately, these test events are supposed to alert the lobby PlayerController to get its own lobby UI and refresh it from information passed to it from the GameMode. I don't understand why GameInstance variables are defunct for the client side PlayerController at login?

Attempting to be thorough here- the GameInstance variables are valid in the previous room, which is basically during all the core main menu front end loop. It's not until the game launches a listen server room (Lobby) and handles player logins does this... race condition... seem to appear on the GameInstance.

Product Version: UE 4.21
more ▼

asked Nov 17 '18 at 01:58 AM in Blueprint Scripting

avatar image

16 1 3

(comments are locked)
10|2000 characters needed characters left

1 answer: sort voted first

According to this post, 1st player controller loads before gamemode: https://answers.unrealengine.com/questions/218671/what-is-the-loadorder-of-objects.html

This seems to be the reason for my race condition.

more ▼

answered Nov 21 '18 at 12:29 AM

avatar image

16 1 3

(comments are locked)
10|2000 characters needed characters left
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