Question by 
               Dwakers92 · Feb 25, 2019 at 02:30 PM · 
                c#guiif-statementssetactivegetmousebuttondown  
              
 
              I am trying to close the GUI if its already active and the user clicks
 void Update()
 {
     if (Input.GetMouseButtonDown(0))
     {
         RaycastHit hit;
         Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
         if (Physics.Raycast(ray, out hit, 1000))
         // adjust the hit distance for the raycast distance to load the GUI
         {
             FloorGUI.SetActive(true);
             Debug.Log("FLOOR CLICKED - LOADING GUI FOR CUSTOMER SELECTION");
         } 
         else
         {
             Debug.Log("FLOOR NOT CLOSE ENOUGH FOR RAYCAST - WILL NOT LOAD GUI FOR CUSTOMER SELECTION");
         }
         if (Input.GetMouseButtonDown(0))
             FloorGUI isActiveAndEnabled
             FloorGUI.SetActive(false);
         Debug.Log("CLOSING GUI, FLOOR HAS BEEN RE-CLICKED WITH GUI ACTIVE");
     }
 }
 
               }
               Comment
              
 
               
              Your answer