How to make lock and unlock button for levels?

I am making a game which contains 8 level, so when the levels are locked the button color is different or icon is different . and you can also help me with any other idea which relate with this.

I want to make like this

274275-hqdefault.jpg

Im new to Unreal myself, but my first attempt would be to create a Game-mode Boolean Variable Array. You have 8 levels so you would have indexes 0-7 and you could set the Boolean for each index indicating if level is unlocked. The array would be set on begin-play reading values from a save (Never done this yet). Your UMG level icons would be variables and you could set the image according to the Boolean value in your array. You could get then enable or disable interaction according to your array Boolean?

can you show the bluprint of this .

You can do something like this. Create an integer variable in the game instance. Each time a player beats a level you increment it (+1 to the value) and set it. When you open up the main menu with the level selection, enable or disable the buttons based on whether or not they are greater than or less than or equal to this value. Sample setup is below. If you are new to UE4 you can also check out these beginner tutorials they may help you with questions/issues you have in the future. It also gives a really good foundation for the basics of blueprints and setting up logic.

The top 3 images are from my UMG Widget Designer Section where I did an Xbox controller and the buttons highlight when pressed. I just remembered I could not find a way to dynamically change the image so I had to put an image on top for the highlighted version of the button and then dynamically set the visibility. To layer the buttons (Image on far left top) I had to use a Scale Box, Then an Overlay Box and the Place in the Images. Put the image with Lock on top of one without. Then When You read your boolean Variable from the array, if true you could set the image to Hidden, and if false set image to Visible along with disabling user input on the button.

You will need to do some homework and look up tutorial videos on creating save game files/information to be able to save the variable info for the levels that are unlocked. Here is link to Tutorial for that -

Don’t forget you will also need to create some type of save variable to archive the players progress for a later load up.

I made This But there is a problem that when i complete level-1 the level-2 will unlock , then i play level-2 and unlock level-3 but when i unlock Level-3 my level-2 is locked .it is not saving all previous data it only save the current data

1 Like

I followed this tutorial

1 Like

Do you want the levels to Unlock in Order or is the Player able to Play and Unlock Levels out of Order? I unfortunately I don’t have time to watch the tutorial and I am unable to read anything on your screenshot as it is zoomed out too far to read the text.

To Unlock in Order - I would check a Level Unlock Variable which would contain an integer of the highest level completed. The run a for Loop from 1 to the Level Unlock Variable. In this loop I would then set all the attributes for your widgets (Will buttons accept user input? Make your layered images visible or invisible to show the lock image).

To Lock/Unlock in any order I would do what I mentioned before and use a boolean array and set the boolean to true if level is unlocked. Then when your menu loads, run a for each loop to set the attributes of your widgets as mentioned above.

I included an Epic Tutorial on Savegame in my post above.

Does this help you?

variable type of level array?

i did this but in my editor set enable’s target is not connecting with
for each loop, i think i’m setting wrong data type. waht data type you set to level array.

The level array is a button type. You can only use the buttons if the level is unlocked.

hey bro i also followd this tutorial i am creating a game in which when player collects coins from 1 level next level should unlcoked in my system everything is fine but when i exit and restart game my all levels get locked excepting the last and first one can you please guide me how to do this