- Home /
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:
And i want to be able to change the time it showing with a variable.
Thanks alot!
Comment
Can you include the script that you currently have for it?
Answer by Nanity · Jun 22, 2013 at 10:37 AM
Not tested, but you should get the idea ;)
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));
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
c# add/move lines of text in GUI box 1 Answer
Gui text, ammo counter 1 Answer
GUI is not showing up, but script seems to be fine 1 Answer
Creation of checkbox next to text 1 Answer