Skip to content

samsawyer85/Unity3d_CustomYieldInstructions

Repository files navigation

ExecuteForSeconds

Execute code while yielding in the same way as WaitForSeconds().

Usage:

yield return new ExecuteForSeconds
    (
	10,
	t =>
	{
	    Debug.Log("Percent of time complete: " + t.ToString());
	}
    );

Note: If you cache an instance of ExecuteForSeconds you'll likely need to call Reset() before using it again.

WaitForFunc

Yield until supplied Func returns false.

Usage:

yield return new WaitForFunc
    (
	() => { return Time.timeSinceLevelLoad > 10; }
    );

WaitForInputTimeout

Yield for supplied time, returning early if any input is received.

Usage:

yield return new WaitForInputTimeout(10);

Note: If you cache an instance of WaitForInputTimeout you'll likely need to call Reset() before using it again.

WaitForNull

Yield until supplied Object becomes null.

Usage:

yield return new WaitForNull(_myObject);

WaitForNotNull

Yield until supplied Object is no longer null.

Usage:

yield return new WaitForNotNull(_myObject);

About

CustomYieldInstructions for halting Coroutine execution in Unity3D

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages