Three button combination to open next scene

I have thirty (30) buttons in a trivia game, they are laid out in the following configuration with three rows:

( A, B, C, D, E, F, G, H, I, J) ( 0, 1, 2, 3, 4, 5, 6, 7, 8, 9) (00,01,02,03,04,05,06,07,08,09) 

Using these combinations of buttons and clicking one and only one from each row I have a thousand (1000) - three (3) button combinations. E.g.: A27 would be one combination of the thousand possibilities. These are not random combinations each opens a very specific scene.

What I am trying to do is create a C# script that when I click any of these three (3) button combinations it will open a new scene. Once that scene is open I’m okay because then have my own scripts attached to the single buttons in the new scene to continue to a further scene.

What I can’t figure out is the syntax, should I use if Statements such as - if (Btn_A) && (Btn_1) && (Btn_01) then load scene such and such? Then do I attach the script to the canvas then to each of the three button combinations (A 1000 Scripts combinations)?


You should not try to hardcode the combinations. Seems fairly straightforward to name your scenes A207, or F409, and so on. When the button combination is entered, simply load the scene with the name produced.

string button1 = selectedButtonA.text;
string button2 = selectedButtonB.text;
string button3 = selectedButtonC.text;
string name = button1 + button2 + button3;


This code executes in a script attached to the canvas object or some kind of manager object. Each row of buttons has a script that sets the selected button values. i.e. the first row buttons, when selected, will assign themselves to selectedButtonA in the scene loading script.

Category: unity Time: 2016-07-29 Views: 0
Tags: unity

Related post

iOS development

Android development

Python development

JAVA development

Development language

PHP development

Ruby development


Front-end development


development tools

Open Platform

Javascript development

.NET development

cloud computing


Copyright (C), All Rights Reserved.

processed in 0.298 (s). 12 q(s)