Search Unity

Opening a pop up menu upon an event being triggered

Discussion in 'Immediate Mode GUI (IMGUI)' started by Anson, Aug 12, 2008.

  1. Anson


    Aug 12, 2008
    Hi all,

    I have recently started using Unity and apologise if this question has already been answered in a previous post.

    I am trying to get a menu to pop up upon an event being triggered.

    So far, from what I have read, in order to display something, it needs to be called in the OnGUI() method. So I basically set up an invisible menu inside the OnGUI() method to only be displayed when its boolean value has been met.

    Code (csharp):
    1. function OnGUI () {
    2.     if(EventTriggered==true)
    3.         DisplayPopUp();
    4. }
    Is there an alternative way to do this, as it doesn't seem efficient to constantly check at every game cycle, whether or not to display the Pop Up.

    Is there a way to just pop up a menu when required, instead of constantly checking to see if a menu should be visible or not.

    Thank you for your help in advance!