Simple question. Are these blueprints persistent through out the whole game?
No matter if the player dies, swithes level etc…
Game mode bp
Player controller bp
Game instance bp
Also is there any more persistent blueprints that I should know of?
Simple question. Are these blueprints persistent through out the whole game?
No matter if the player dies, swithes level etc…
Game mode bp
Player controller bp
Game instance bp
Also is there any more persistent blueprints that I should know of?
Game instance is the only one that persist through changing a map as far as i know.
Game mode and PC persist even though your character dies, but they get reset on a new map
of those 3 only GameInstance is persistent and would survive for example a level switch.
Also bear in mind if you spawn an actor in a level and change level, even storing that actor in a GameInstance variable wont make the actor survive because the spawn happens in the current root level opened.
But say for example you spawn a sword actor in one level, how can you keep the sword to the next level?
And also different inventory items and ammo count if you got guns in the game, and stuff like that?
everything you spawn in a level during gameplay will be destroyed when you load a new level
What I do for my games is work everything under the same MAIN ROOT LEVEL and load all other levels as stream levels of this one. This way you never fully load a main level and the MAIN level you create is always alive. This also allows you to async load during the game.
for example If you have a very clean main level (almost an empty level) as root, when the game starts, you can load it very fast and keep loading the rest of the game with some graph, video, etc) while the game keeps loading all needed in the background.
As I never full open a level again, everything I spawn survives because spawn put things in the main level that is opened (not in the sub-levels) and as I never destroy the main level, things stay there.
Okay now I get it. You create a main level thats always active, and have all other levels as kind of sub-levels.
I had no idea you could do this. Haven´t gotten that far in my Unreal Engine “education”
But it makes much more sense now. Thank you!
Here is a little example I did that maybe can help you understand a bit Levels and stream levels.
When you open a level it will reset everything and totally start fresh.
When you have a level open and you hide it, the level will stay hidden and everything on it wont even tick, but when you unhide it, beginplay event will run again BUT all the variables and states of the level will remain. When you CLOSE the level you lose all.
When you spawn, no matter you have sublevels loaded, you cant assign that spawn to a specific level. That spawn will lieve in the MAIN level and if main level is reloaded then that spawn will die.
I did this example in UE 4.26 and if you want the project just let me know…is not too complex!
Bye
Dany
Thanks alot Dany. No need to send me the project at the moment. You already helped me alot. I had no idea you could do this stuff with level streaming. (Im still kinda noobish)
All I can say right now is a BIG Thank You! I will definitely have use of this in the future.
If you have time, is it possible to put that on github?
Can I send you a WeTransfer link with the project privately and you upload to GitHub and share here?
I never used Github
sure no problem. I might not get to it immediately but i can put it on github and maybe make a community tutorial link for it as well so people can find it easily in the future. Seems like one of those very helpful example projects like matthew wadstein was putting out on youtube for several years.