Hello!
I need some help. In this script countdown, in my game is activated by triggers and also always disabled with trigger.
everything works fine, but when reactivated through triggers the sript countdown will not start again from 60 seconds, but always remains zero. How do I update this script so that it always start again from 60 seconds every time the script reactivated?
thank you!
My current script.
public var currentTime : int = 60;
var style : GUIStyle;
function Start()
{
InvokeRepeating( "CountDown", 1, 1 );
}
function CountDown()
{
if (--currentTime == 0)
{
Debug.Log("Time is up my friend");
CancelInvoke( "CountDown" );
}
}
function OnGUI ()
{
GUILayout.Label(currentTime.ToString(),style);
}