You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
new WaitForSeconds() and the other coroutine yield functions create garbage. Some of these yield functions are cachable, which will reduce garbage allocation, thus improving performance.
Proposed solution
IEnumerator Coroutine()
{
yield return new WaitForSeconds(2f);
}
to
WaitForSeconds _wait2Seconds = new WaitForSeconds(2f);
Problem statement
new WaitForSeconds() and the other coroutine yield functions create garbage. Some of these yield functions are cachable, which will reduce garbage allocation, thus improving performance.
Proposed solution
IEnumerator Coroutine()
{
yield return new WaitForSeconds(2f);
}
to
WaitForSeconds _wait2Seconds = new WaitForSeconds(2f);
IEnumerator Coroutine()
{
yield return _wait2Seconds;
}
Same for similar methods
The text was updated successfully, but these errors were encountered: