About offcial UMG inventory tutorial.,About official UMG inventory tutorial

I followed the tutorial and everything works fine,but when I load a new level in game,I cannot use the item that I got in the previous level any more.
I think maybe open a new level everything is initialized,and the item instance is lost.I do not know how to make it work.Please help me.Thanks!

Store data in GameInstance instead GameMode or GameState

Thanks I tried that,I do not know exactly what I should store.Could you tell me?Thanks again

Inventory data located inside “Inventory Struct” array named “Inventory”. That array located in WidgetBlueprint named “/Game/UMG/GameHUD”.

So you need to move that array from Widget to GameInstance and rewrite all codes accessed this array to new location.

Or you can copy that array to GameInstance before level change and copy back after new level loaded

There are a series of tutorials under Unreals YouTube channel dealing with saving and loading. I believe it’s about implementing and saving lap times on a racing game. Same principle should apply:

ThanksI saved the Inventory before loading a new level and load it after opening the level and the item exists in the inventory but I still cannot use the item—the Use event(Interface event) cannot be called correctly.I consider that maybe the item be destroyed in the previous level,and cannot be found in the current new level,so the event cannot be called.I don’t know how to solve it.Thanks!

ThanksI saved the Inventory before loading a new level and load it after opening the level and the item exists in the inventory but I still cannot use the item—the Use event(Interface event) cannot be called correctly.I consider that maybe the item be destroyed in the previous level,and cannot be found in the current new level,so the event cannot be called.I don’t know how to solve it.Thanks!

Yes I think I get your problem. Here is the way I see it.
The objects are instances of the current or last level with no reference of being a pickup of the current level. If I remember correctly he only hid the instanced items in the level on pickup and on drop moved the item to a new location in the same level it was picked up in. and made it visible again. Yeah it didn’t make sense why he choose to do it that way when I was watching it.

As for a solution, …create an Instance of the items yourself after loading the save or last level details from a GameInstance.
Instance on level load and use a count to maybe trigger so many of each kind of object. Finally add them to your inventory manually to start the level. That is my best attempt and 1st post to the UE4 forums

Good luck, X

Sorry for the late reply!Could you show me how I can create an instance of the item after loading a new level?Use which blueprint nodes?Could you please post some screenshots?Thanks in advance!