- Home /
UI Button Code in Correct Order
I've looked into a couple solutions to this, and I'm just not sure how to go about achieving the simplest solution. One solution was riddled with problems like missing syntax and outdated strings, the other was just the code and no explanation on what to change to get it to register the "correct order" and I've been playing with it for an hour with no success or breakthroughs. Everything else I've found has just been people explaining safe code style puzzles and their programming focuses heavily on showing the display of the code numbers, when all I need is an internal system to keep track while the buttons are pressed.
I have a 9 number puzzle. Each number is a UI button that you need to click in the correct order, or else the puzzle resets. I'm just not sure what to use to ensure that the numbers are clicked in the correct sequence, and as soon as one is clicked out of order, the puzzle resets. I might be over thinking it, but I'm just not sure where to start with this one haha.
Answer by danidani360 · Aug 05, 2021 at 09:59 AM
@AnonymousCheese I would have each button return the proper number of it's sequence to a script that checks if it is one greater than the last. In the else statement, add the proper code to reset your board. Attach this script to the canvas, then add the ButtonPressed method for each button's OnClick. You should see a box come up with a 0. This is where you but the proper number in the sequence. Hope this helps! :)