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"

load data from Game Instance

I somehow managed to post this in the wrong forum first and it disappeared so I'll try again.

I got some great help here just the other day and it got me quite far. I decided to extend something I'm working on a bit and even though I got a great example from a user here that did pretty much this I still can't figure out why it won't work for me... I'm clearly overlooking something here...

I simply want to load some transformation data I stored (successfully) in my Game Instance class. I did some ingame print outs (top left) in the first class I fetch transformation info (green) and save it in the Game Instance (pink) and then I try to load it in my Character class construct (orange) but it's set to the default 0,0,0 there instead of loading the correct value...

alt text

Anyway thanks for all the help so far here I'm making slow, slow progress at least.

Product Version: Not Selected
more ▼

asked Jan 03 '17 at 04:58 AM in Blueprint Scripting

avatar image

8 4 5 8

avatar image PhilipK Jan 03 '17 at 08:28 PM

Hi Sean,

Thanks for the reply! I see, that makes sense. I'm storing it as soon as I fire up the game so it'd probably be an issue there as you say. I will try that as soon as I get home. Thank you!

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

1 answer: sort voted first

Hey PhilipK,

When are you storing the transformation data for your character class?

It's possible that you're attempting to load the data before it has been successfully stored in terms of order of operations. Try printing the value on BeginPlay instead of Construct and see if you're getting the correct transform values.

Let me know your results.

more ▼

answered Jan 03 '17 at 07:41 PM

avatar image

Sean L ♦♦ STAFF
43.5k 485 152 442

avatar image PhilipK Jan 04 '17 at 05:07 AM

Ok so I tried what you said and I initially got the same result but then I tried adding a "delay" function and now it works. This is probably not the most elegant solution :S

The blueprint I save this stuff from is simply a type of "locator entity" that I purely use for it to be easy for me to place a transform in the world and use that to spawn a bunch of different stuff. For that one I also use BeginPlay to save off the transform, would there be a better way to more instantly save off that data or is that the quickest way?

I basically need all this stuff to happen as soon as I load a new map...

Thanks a lot for explaining this and pointing me in the right direction on this, definitely hard to figure out why this was happening.

avatar image Sean L ♦♦ STAFF Jan 04 '17 at 04:01 PM

No problem, glad to help. A lot of the time when you see an issue like this occurring it can just come down to order of operations issues, i.e. the variable is being printed before it's had a chance to be set. So I'd always recommend either adding a short delay as you've done, or moving it to a function that is called shortly after you begin play so that you can ensure that value has been initialized.

(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