Creating dynamically moving buttons/GUI objects.
Hello, I am creating a hybrid quiz/RPG-ish game. I have most of the game basics done and the problem that I am facing is that i am unable to randomize the options for my game. The options are pulled from an SQL database and are projected onto the text of a button.
The buttons are then coded so that the character either does damage or gets damaged. The issue is that the right answer is always on the bottom as that is the button that displays the right answer. I am wondering if it's possible to randomize button positions with the anchors so that the answer isn't always at the bottom.
Here's a screenshot if it provides any clarity SCREEN
Answer by KwahuNashoba · Oct 01, 2015 at 02:28 PM
I would say that there is no need for hardcoding bottom-most button to be the one that will trigger function to handle right answer. You can randomise answers and then on click check if text on the button is same as correct answer text. You can then handle demage based on the output. This way each button will have universal behaviour.
I mean, you can move UI elements just like you move 3D objects except you'll have to use Rect transform instead, but IMHO this is more painfull way to do this.