Quantcast
Viewing all articles
Browse latest Browse all 108

GUI Buttons unresponsive in new window

I know I must be doing something very silly since this seems to be working in other parts of my code but..

void OnGUI()
    {
        int win_height;
        int win_width;
        if (rdc_requestConfirm)
        {
            win_height = 60;
            win_width = 360;
            win_left = Screen.width - win_width - 25;
            win_top = 80;

            GUI.Window(2, new Rect(win_left, win_top, win_width, win_height), Show_ConfirmationWindow, "");     
        }
  // more stuff
}


    void Show_ConfirmationWindow(int winID)
    {
        if (!Confirmation_Pending())
        {
           // return;
        }

        int btn_width = 180; int btn_height = 30;
        int btn_left_1 = 0; int btn_left_2 = btn_width;


        GUI.BringWindowToFront(winID);
        GUI.FocusWindow(winID);       

        if (GUI.Button(new Rect(0, 0, 360, 60), "click")) { Debug.Log("click"); }

        GUI.UnfocusWindow();
    }

The new window shows up as desire, I can see the button, but when I click on it nothing happens. I've also tried it without setting the focus, with setting the focus in the OnGUI, I just can't seem to get it to do its click action. It does acknowledge that its clicked in the sense that the button changes its look for a moment (and then changes it whenever I mouse over it), just seems like it can't complete its self. I saw someone in the old forums with the same question from a few months ago but I can't seem to find anything with the solution.. So, am I being really silly? Should this be really obvious and I am missing it?


Viewing all articles
Browse latest Browse all 108

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>