-
Notifications
You must be signed in to change notification settings - Fork 1
DelayedCall
Jan-Ole Schümann edited this page May 21, 2017
·
5 revisions
DC DelayedCall(float delay, Action callback) DC DelayedCall(float delay, Action callback, object pars)
DelayedCall allows to call a method after a certain delay. It can be used both with and without an argument that is passed to the method. DelayedCall returns a DC object which allows to terminate the delayed call using the Kill() method of the DC object.
In this example, the method onDelay is called after 2 seconds with a GameObject passed as a parameter.
void Start ()
{
GameObject gameObject = GameObject.Find("name_of_gameobject").gameObject;
Action<object> onDelay = this.onDelay;
TweenSharp.DelayedCall(2f, onDelay, gameObject);
}
private void onDelay(object obj)
{
Debug.Log("Name: " + (obj as GameObject).name);
}