I have a struct called Timer. I create an instance of it inside of a coroutine
private IEnumerator StartTimer()
{
var timer = new Timer(5f);
while (timer.Time > 0)
{
timer.Tick(Time.deltaTime);
yield return null;
}
print("Time's up!");
}
I know that value types inside of a method are stored on the stack, but an exception to this is if they are a part of an iterator block. So if I instantiate Timer inside of a coroutine, does that mean that it’s a part of an iterator block and will not be allocated on the stack?