if you have a good look at the script and see what everything is doing you will find its blatently clear the way to switch on and off the GUI. If you want to permantly destroy it then have a look at the destory script reference http://unity3d.com/support/documentation/ScriptReference/Object.Destroy.html
OnGUI is ran every single frame. It's equal to Update. Having said this, you can't do a yield/WaitForSeconds (It isn't WaitSeconds) as that stops the frames.
Unless you have a method called WaitSeconds which takes the int you passed in, and then returns true when it's above the time...
So, what I'd do. Have a temp time, make it equal to the System time.
Then have an if statement comparing the current time and that one so like.
var tempTime = System.DateTime.Now.TimeOfDay.Seconds;
function OnGUI()
{
if(tempTime+3 > System.DateTime.Now.TimeOfDay.Seconds)
{
//draw
//play sound
}
}
it helped a lot tnx !
– kilian277one last question how do i destroy the message after showing ?
– kilian277if you have a good look at the script and see what everything is doing you will find its blatently clear the way to switch on and off the GUI. If you want to permantly destroy it then have a look at the destory script reference http://unity3d.com/support/documentation/ScriptReference/Object.Destroy.html
– anon61858128don't mind i found it
– kilian277oops late see !
– kilian277