maa2007
(maa2007)
May 2, 2017, 6:27am
14
I know it can be confusing because there are many different ways of doing things.
If I understand you correctly, you want to create different levels (worlds) and then move between them while retaining properties from level to level.
So for example, you have 2 levels and when moving from Level 1 to Level 2, you want to retain your Player Stats (say coins collected, lives, etc). Another example is object states (like if you open a door it should remain open). All these things can be done, but UE4 doesnt do this automatically.
Each level creates its own instances of the classes (actors). So you must save this information between levels yourself.
The Game Instance Blueprint retains all its variables during the game session no matter the level.
So here’s an example:
You are in Level 1 and collected 50 coins. You cleared the level and now load level 2.
Create a variable called Coins of type Integer in your Game Instance.
Before you exit the level you want to save the 50 coins in your Game Instance - Cast to your Game Instance and SET that variable with the number of coins.
Load Level 2 (Open Level node)
On Begin Play cast to Game Instance and GET the value of variable Coins and SET your Player variable to this value.
It sounds more complicated than it really is. The basic idea is that you want to save the variables in your Game Instance to preserve them between levels.
Hope this helps!
thanks for the reply, but is this the normal way of doing things, or you are trying to solve my problem in a weird way, because i want to understand how the program is meant to work