Change Levels via an array ?

Hello, I’m a new user and I’m working on a rolling ball game to learn Unreal Development. I can set up trigger box and blueprint it to open level and load the next level via the level name. I have created simple shape static meshes that I am using to build my levels. Can I setup a mesh that would be the “Goal” and when the pawn enters it, it will load the next level from an array of all my levels ? I.E. if you reach the goal of Level 1 it will then load Level 2 ? How would I go about it ?

Well creating an array containing all the names for your levels is simple enough.
More info on arrays: Blueprint Arrays | Unreal Engine Documentation
You would want the array to be of type “name” as that’s what the Open Level node requires.
As for the goal, an actor blueprint with a simple collision detection box should suffice. (You can add a collision box using the add component button)
More info on collision and customizing responses: Collision | Unreal Engine Documentation
In your “Goal” BP, create a collision box/sphere/capsule and make sure you’ve enabled the On Component Begin Overlap event and set the collision responses for the collision box to ignore everything except a pawn.
Then in the event graph from the overlap event you just get your current level which would be an integer stored in a Game Instance BP (UE4 - Using Game Instances & Persistent Variables - YouTube) increment it, use the new value to get the corresponding level name in your level array which I think should also be stored in the Game Instance BP and load the next level. Also, when you increment, make sure you update the value in the Game Instance BP as well.

Something like that.

Also, I added the links just in case, I have no way of knowing the extent of your knowledge.

1 Like