Switch Level using button (Increment and decrement) at Run Time

I have 20 levels with a common widget and 2 buttons (LEFT and RIGHT). When i click on the Right button i want the level to increment ( 1 , 2 , 3 , 4 , 5 ,…20) and which i click on the Left button it want to decrement level (20, 19 , 18, 17 ,…1). Please help with this

Hi man,
In your widget create a variable array of names,
compile and set all the names of your level in the array.

on clicking NextorPrev level
use Get current level and use a loop to get in witch level you are in .

Loop the array you created and check if the level name is == to the current level.
If yes you will have the index of the loop,
that will tell you the level you are in,

So Use OpenLevel feeding in the NameArray get indexloop (+1) or ( -1)
check if is the first or the last, and do something different

Thanks for reply , i understand the concept, Sorry i could keep it working. Could you please make a video as i am not able get this forward.

hi man, here an old answer i got,
1: be sure to create a array of strings where you are calling this event.
2 Once the loop detect the current level you have the index of the level you are in.
So after the branch, you can open the level in the array and just add 1, or -1 to get the previous or next level, “Array All Levels Names” + get index+1 or -1

Hi - I just followed your Blueprint, When clicking on the button i get " shutting down PIE" I am not sure what i missed. I have attached Blueprint snapshot and error snap shot for reference

It’s because of the Append. You’re setting the Level Name from the Append String node, which means that the Open Level node is reading Level Name as “The Next Level is [Next Level].”

Try putting that **GET **node into the Open Level node.

Additionally, unlike Est_engine’s example, you are using an Array of Strings rather than an Array of Names. It honestly shouldn’t be a problem because you’re converting the String to a Name, but I wasn’t sure if you were aware of the difference.

Thanks Jason and Est it works . Thanks you for you help. Is there any way that i can loop the first and last level. where i click the increment button on the last level i want it to loop First level and same for the decrement button. Thanks.