- Home /
 
LoadLevel with 2 different buttons Pressed
i am making a game where there is a ready system, meaning two buttons need to be pressed, for this case shift and option, how would i make it so as soon as both buttons are pressed (not at the same time),
i didnt finish this by accident, but what i meant to say was how would i make it so as soon as both buttons are pressed (not at the same time), they would load a new level, thanks.
Is there an order of pressing the 2 buttons? Like you should press Button1 and then Button2. Then only scene will be loaded !!!
if so, create a boolean and make it true on pressing Button1.
On pressing Button2, check if boolean is true. If so, load the scene.
eg,
  bool isBtn1Pressed = false;
     
   public  void Button1Pressed()
     {
            isBtn1Pressed = true;
     }
     
    public  void  Button2Pressed()
     {
         if(isBtn1Pressed == true)
              Scene$$anonymous$$anager.LoadScene(sceneNo);
     }
 
                  Call the function Button1Pressed() while Button1 is pressed and Button2Pressed() while Button2 is pressed.
Note that, you should add using UnityEngine.Scene$$anonymous$$anagement; to access Scene$$anonymous$$anager.
If there is no order of calling the Buttons, then You should use two booleans and check if button1Bool is true while pressing Button2 and vice-versa. (here you will call the load-scene and condition-check in two places.)
Hope this helps..
Your answer
 
             Follow this Question
Related Questions
LoadLevel easy i know, but not working. 1 Answer
Android: Scene change (Application.LoadLevel) has no effect 3 Answers
Same Scene - Different Button in One Script 0 Answers
Change to scene based on current scene 1 Answer
GUI button inconsistent -1 Answers