Skip to content

About

Unity WaitForSeconds wrapper Class to avoid GC call.

Resources

Stars

4 stars

Watchers

1 watching

Forks

Latest commit

 

History

6 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 

Repository files navigation

WaitForSecondsUnity

Unity WaitForSeconds wrapper Class to avoid GC call.

This kind of code makes food for C# Garbage Collector at every calling time.

    yield return new WaitForSeconds(1.f); 

But, you can avoid that problem if you cache and reuse it.

Usage

    // wait 1 second 
    yield return WaitFor.Seconds(1.0f);
    
    // wait 3 second and execute a method
    yield return StartCoroutine(WaitFor.Seconds(3.0f, DoSomething()));

FixedUpdate and EndofFrame

    yield return WaitFor.FixedUpdate;
    yield return WaitFor.EndOfFrame;

About

Unity WaitForSeconds wrapper Class to avoid GC call.

Resources

Stars

4 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages