Dialouge text.

I dont know really what to search for and what i search for isnt what im looking for.
I’m looking for a script that when a player does something (and activates a trigger), a GUI text shows up as a dialouge.

Like this:

alt text

And i want to be able to change the time it showing with a variable.

Thanks alot!

Not tested, but you should get the idea :wink:

private string popupText;
private bool isPopupActive;

public IEnumerator activatePopup(string text, float duration)
{
    isPopupActive = true;
    popupText = text;
    
    while (duration > 0)
    {
        duration -= Time.deltaTime;
        yield return null;
    }
    isPopupActive = false;
}

private void OnGui()
{
    if (isPopupActive)
        GUI.Button(new Rect(....), popupText);
}

Call it by:
StartCoroutine(activatePopup(“This is a popup”, 2.0f));