Hi. I need help with one thing, that i can’t make.
Can anyone explain me how to destroy GUI.Label after X seconds? And maybe how to add fade out transition (if possible).
Please write the code in C#, because i;m understanding it faster than JS
GUI code is immediate mode, so GUI.Label only exists for one frame, therefore it’s not something you ever destroy. Rather you can just stop using it after X seconds in your OnGUI function, using some kind of timer (using Invoke would be a simple way). You can use a boolean (“if (showLabel) GUI.Label(…)”), or for best performance disable the script, that way the OnGUI function will stop running entirely.
public GUI.Label m_temp;
public float m_seconds = 5;
void Start()
{
destroy ( m_temp, m_seconds );
}