Hello, unity will any expert can give me a hand? I want to bring up a window with a menu! I play it on the menu to appear, it appears, but if I touch it in the options window disappears ... How can I do this? Code: public Rect windowRect; public GUISkin windowDicaSkin; public bool limao01 = false; // Use this for initialization void Start () { } // Update is called once per frame void Update () { if(Input.touchCount == 1){ Ray ray = Camera.main.ScreenPointToRay(Input.GetTouch(0).position); RaycastHit hit; if(Physics.Raycast(ray, out hit)){ if(hit.transform.tag == "SairDicas"){ Application.LoadLevel(0); } } } } void Awake (){ windowRect = new Rect(Screen.width / 2 - 300, Screen.height / 2 - 250, 500, 500); } void WindowFunction ( int windowID ){ if(windowID == 0) { GUILayout.TextArea("Segundo OMS, o Brasil produz diariamente 600g de lixo por pessoa.", 400); } } void OnGUI(){ if(Input.touchCount == 1){ Ray ray = Camera.main.ScreenPointToRay(Input.GetTouch(0).position); RaycastHit hit; if(Physics.Raycast(ray, out hit)){ if(hit.transform.tag == "limao01"){ limao01 = true; } if(limao01){ GUI.skin = windowDicaSkin; windowRect = GUI.Window(0, windowRect, WindowFunction, "", GUI.skin.GetStyle("window")); } } } }
public Rect windowRect; public GUISkin windowDicaSkin; public bool limao01 = false; // Use this for initialization void Start () { } // Update is called once per frame void Update () { if(Input.touchCount == 1){ Ray ray = Camera.main.ScreenPointToRay(Input.GetTouch(0).position); RaycastHit hit; if(Physics.Raycast(ray, out hit)){ if(hit.transform.tag == "SairDicas"){ Application.LoadLevel(0); } } } } void Awake (){ windowRect = new Rect(Screen.width / 2 - 300, Screen.height / 2 - 250, 500, 500); } void WindowFunction ( int windowID ){ if(windowID == 0) { GUILayout.TextArea("Segundo OMS, o Brasil produz diariamente 600g de lixo por pessoa.", 400); } } void OnGUI(){ if(Input.touchCount == 1){ Ray ray = Camera.main.ScreenPointToRay(Input.GetTouch(0).position); RaycastHit hit; if(Physics.Raycast(ray, out hit)){ if(hit.transform.tag == "limao01"){ limao01 = true; } if(limao01){ GUI.skin = windowDicaSkin; windowRect = GUI.Window(0, windowRect, WindowFunction, "", GUI.skin.GetStyle("window")); } } } }