How to Get Struct into A New Blueprint

I have a struct

I attached a struct ref to a SetMembersInStruct node.

Struct Out creates a “reference to the input struct”, I would like to bring this reference to a new blueprint.The reference output of struct will not attach to any node that I can find or lookup.


Have a look at this tutorial - it explains how to use Structs.
While you’re there, also have a look at the rest of the series. It’s very worthwhile.

  1. break the struct
  2. make new struct
  3. connect the pin of the values that you want to preserve to the new struct

a struct is a “value type” which means that you cannot change it, you can only make a new struct using older struct values

Do you mean, grab a struct variable and assign it to another BP? If so, just cast to the other BP and assign a struct variable on that one.

If you just need to use a struct that is on another BP, then again, you’ll need to cast to the BP with the struct and grab it. Then you’ll be able to use it.

Can I see a screenshot?

When casting to a BP you have to give a reference to it, which can never be a struct variable

That doesn’t show me anything

You’re trying to save a struct variable in a savegame class, right? Can I see the entire BP? I might be misunderstanding

I want this in the other blueprint so I can store the data and keep adding to it, as a game save.

I have this set next to a SaveGameToSlot, but am unsure of how to add this variable to the save slot, so I am going to try and cast it to the other gamesave blueprint so I can create variables and add the struct variables to those to keep a saved variable of all struct variables that may increase or decrease over time (when the game exits and reopens the data will stay into the casted blueprint).


I am setting the values stored inside struct Inventory. I just need this to be stored in my savegame “New Blueprint” blueprint so I can read from it and do something with the stored data Inventory.

I drag my struct variable Inventory from my savegame blueprint “New Blueprint” onto the event graph and break it. I try to print the integer variable but not even a custom event will trigger the print in the savegame blueprint.

If I am setting my Inventory in my “ZZZZ” blueprint and drag Inventory into my savegame “New Blueprint” blueprint, shouldn’t that integer value transfer?

If so how can I get my print to work inside of my savegame blueprint, “New Blueprint”, because there are no EventTick or OnBeginPlay nodes for any node to function.

Alright I see what you’re trying to do.

I’m certain the problem is how you’re saving. I see some problems, but maybe it’s best I just show a screenshot of a working struct save/load I just made

Yeah. So is yours… I thought you were trying to save a struct and load it, right? The BP shown does that :slight_smile:

And yeah, those are reroute nodes. Same as using the variable itself.

I’m really sorry but I’m not really understanding what the problem is… You can’t save the struct? Load it? Both? And what’s with the setting the struct members? Is there a problem with that?

So, if I understand right…

Simply saving the struct will work fine. And when you start the game again, loading the savegame, assign the saved struct to your struct, and let it continue to grow. So, as long as the saving & loading works, everything else should work fine.

Not sure if I can be much more help unless I am on the project myself, you know?

I just set up my BP to do the same, and it works fine. Not really sure what else to try :frowning: sorry

This is how I followed with my Struct variable Inventory.

Now how do I save CT and ST from Inventory in my savegame blueprint so that it does not get erased? I will drag Inventory from savegame blueprint into the event graph, break the struct and send the int values to new variables, then store those new variables into an array. That way gamesave blueprint can keep getting new CT and ST values that can be added to the new variables that will be stored in arrays, and hopefully on exit of the game (or when testing in UE4 on stop and play of game) the array can keep obtaining new values for use in expressions. To test it I will add the CT and ST values to the new variables.

But how can I print this data or store the data in a widget if the savegame blueprint cannot utilize the nodes with events? The nodes sit in the savegame blueprint but I have never found a way to utilize them for use in widgets or other blueprints.

I forgot to add the false branch so here it is:

I just don’t know how to get my Inventory into my savegame blueprint for storage if the game closes, and how to get that data from other blueprints throughout the game.

I can trigger the SaveGame event. I’m not sure what happens after that. It is supposed to create a save game object, but where does that get stored and is it interactive? Or will the folder for savedgames appear with the save slot name save01 for my save?

The struct has two integers which get values when playing the game. There is no problem with sending these values to the inventory. But all I see is the inventory is set, then the SaveGameToSlot occurs, so I’m guessing save01 is created in a folder.

After this point my savegame blueprint is empty, I only gave it the variable Inventory so that I could break the struct and store the two integer values to an array, so I can bring that array to widgets to show the integer values, and bring it to other blueprints if necessary.

I’m not sure how to work inside the savegame blueprint to store these struct variables so that after each new play of the game the variables in the array will continue to grow, with each new value being added to the newly created variables being stored in the array – that get the set inventory values.

So I have load game hooked up to eventBeginPlay.

After destruction of my player I call the event SaveGame.

When I load the game though, the variables don’t show any change.

Might you know why?
Store is being called after player death. Then SaveGame is being called after Store.

So in theory my CT variable should be saved, but every time CT should be added 1, the printed CT variable states 1 and not 1+1, etc.

This is all that I have:

Can you check those blueprints for if I am missing anything?