Having two GUIs in the same scene

Hi Guys,

I know this might sound noobish, but I was wondering if it’s possible to create 2 separate GUIs within one scene.

I’ve added one to an object within the Main Camera parent object, which serves as a pause menu. How would I go about making another, totally different one, that would activate on player’s death.

I’ve added another independant game object and designed the GUI within it’s OnGUI() function. How would I call it, without the first one activating?

Thanks so much. :slight_smile:

Well you can go the way you went and enable/disable separate scripts by setting enable to true/false respectively.

Alternatively you could just wrap your “separate GUIs” in if statements and just change bools when needed, e.g.:

internal bool gui1 = false;
internal bool gui2 = false;
internal bool gui3 = false;
void OnGUI()
{
    if (gui1)
    {
        //your GUI #1
    }
    if (gui2)
    {
        //your GUI #2
    }
    if (gui3)
    {
        //your GUI #3
    }

    //or if you want to make sure that only 1 will be shown even if all gui booleans will be set to true, then:
    if (gui1)
    {
        //your GUI #1
    }
    else if (gui2)
    {
        //your GUI #2
    }
    else if (gui3)
    {
        //your GUI #3
    }
}

Of course it’s possible. Just do it the same way you do one, but twice. Are you having problems with that approach, or have you not tried it yet?