Maintaining inventory and variables through different levels

My basic setup currently is two separate levels. I have a Hub Level and a Game Level. I can pickup a weapon on both levels but when I open the other level, it will clear the weapon and any variables gained on the previous level. What’s the best way to keep all of this between levels? I’ve tried Level Streaming but not sure it’s quite right for this situation.

Thanks in advance.

1 Like

You need a game instance :slight_smile:

https://www.youtube.com/results?search_query=ue4+game+instance

You could do it with streaming, but then you need a blueprint resident in the persistent level to record the values.

1 Like

Okay thanks! I’ll take a look at game instances now.

Will a game instance be able to keep things like the weapon I’m holding as well? or are they mostly for variables

It can hold anything a blueprint can hold, within reason.

If you’re using ‘open level’, you will always need to rel-load everything because it’s a totally fresh start.

If you’re using streaming, the player can walk from one level to the next with gun intact etc…

I tested out level streaming but it loaded both levels on top of each other and I panicked lol

That’s what it’s for, you can load one, or many :slight_smile:

True, although I wasn’t expecting it to just place all the geometry ontop of each other lol

Yes, it will. Unless you put the geo in it’s own respective area in each level, or, use ‘load streaming instance’ ( called something like that ). Then you can put it in the right place.

Ah okay thank you. I’ve ended up going with setting up a game instance and calling that for all my variables I want to take between levels

1 Like