Hey guys,
I’ve run into a problem with the game instance trying to pass variables across maps. I set the instances copy of the variables using a two part method:
First a group of the variables are set, with some being left as defaults for now.
(The prints occur offscreen but I just get the game instance, cast to the specific type, and then get the variables that I want and print the display names)
Then the map changes
Then the player character gets the values and prints them.
Now when the player character prints the variables after the map change some are not the same as the ones that are printed immediately before, instead being the default ones that were mentioned earlier. I don’t know where to go from here, so as always if anybody can enlighten me as to what I’ve done wrong it would be greatly appreciated.
UPDATE:
The problem appears to have something to do with the blueprint not setting the instance values correctly because I printed it in multiple other locations in the original map and the problem is still the same. I replaced the yellow print to print the same thing across all 6 of the objects that perform the task and only one of them printed the answer I needed meaning that the problem must lie somewhere in the way it is being set and/or printed.
The variable is being set in a way that means that when it is called by the blueprint that sets it it will return the updated variables and yet it must not set that variable within the instance itself.
it looks like a lot but thats just because there are lots of values involved. The key part is that I set the SPImage value in one blueprint and then attempt to print the name of it before and after changing maps and its different each time. Nothing else occurs in between the map change.
yep, I must have it set because the other values that I pass through retain their set values. The problem is local to the values set in the second image.
Question 2: Are you setting the values from you game instance by reference? If not they will just return a copy. You need to modify the original value via ref / or by overwriting the value with the outcome (not good for changing single variables though).
UPDATE:
The problem appears to have something to do with the blueprint not setting the instance values correctly because I printed it in multiple other locations in the original map and the problem is still the same. I replaced the yellow print to print the same thing across all 6 of the objects that perform the task and only one of them printed the answer I needed meaning that the problem must lie somewhere in the way it is being set and/or printed.
The variable is being set in a way that means that when it is called by the blueprint that sets it it will return the updated variables and yet it must not set that variable within the instance itself.