This is the struct (just an example):
In Game Instance I created an array and populated the struct for each level:
I’m assuming you have a blueprint in every level that calls the Event PowerOn. If that blueprint had a public integer, you could do this:
-
First get a reference to the Game Instance:
-
I’m using an interface to “complete” each level. You can use that reference to update the struct corresponding to that level, in this case calling CE_CompleteLevel passing the LevelNumber integer.
-
This is that event in Game Instance:
-
First check if the level has been completed, if not then update and continue to next level.
-
Next update the bool in the struct.
-
The branch checks if all levels have been completed by comparing the int with the array length-1, if not ++LevelToLoad.
-
Finally call to load next level:
Simple enough so far…
So we basically turned this:
Into this:
With the added bonus that if I add 100 more levels, all I have to do is update the array of structs.
Hope it helps.
Also, forget the idea I typed in prev post… it’s overly complicated for the same result.