Arithmetic game

Hi Unity community

Well first of all, I am a noob in Unity. I am doing a simple arithmetic game for children, in which the user is going to see a little operation on screen like:

3+2= ?

and from above the screen 3 figures will fall and inside them are going to be three possible answers, only one correct of course, in the example should be 5.

I am not sure on how to generate two random numbers and the correct answer in order to place them inside the figures.

Also I don’t know how to put correctly the operation on screen, I know that it can’t be a simple text, because it must be somehow “connected” to the answers inside the figures.

Where should I start?

Thanks in advance for any help :slight_smile:

alt text

From a high-level perspective (since as others have mentioned, you’re presenting a few different issues)-

You could use an Array with a length of 3 (assuming you will always have 3 results). I guess I would set an Int AnswerPosition, then generate a random number between 1 and 3 to determine which Array cell the answer will be in.

Calculate the answer, then create a For loop that iterates through each cell in the Array. If the cell # equals the AnswerPosition you generated, the cell equals the real answer. Otherwise, generate a random number between whatever number range you want.

Once you have all of that set up, it should be relatively ‘simple’ to iterate through the Array and display the number in each cell in order and within the boxes that you’re displaying.