namespace Zinnia.Event.Yield { using System.Collections; using UnityEngine; /// /// Yields at the End of the Frame. /// public class WaitForEndOfFrameYieldEmitter : YieldEmitter { #region Yield Settings [Header("Yield Settings")] [Tooltip("The number of frames to wait before yielding.")] [SerializeField] private int framesUntilYield = 1; /// /// The number of frames to wait before yielding. /// public int FramesUntilYield { get { return framesUntilYield; } set { framesUntilYield = value; } } #endregion /// /// The instruction to yield upon. /// protected WaitForEndOfFrame yieldInstruction = new WaitForEndOfFrame(); /// protected override IEnumerator YieldOn() { for (int i = 0; i < framesUntilYield; i++) { yield return yieldInstruction; } } } }