Give Page Feedback | API

Secondary Non Components - Yield Or Continue

A special wrapper for a Unity YieldInstruction. In most cases you will not use this class directly. It is used throughout SAM in coroutine methods to indicate to a World or other component that makes use of it that the component should query an attached Execution Controller to see whether the method should yield for a frame or continue executing. This is meant to allow for flexible execution of these methods to account for variations in game performance in different frames.

It's basically as if the method were saying, I don't need to yield, but if you (the object driving the methods execution) need me to so that the game doesn't lag, I can.

If you want to use this construct, all you need to do is yield return YieldOrContinue.Instance. The instance is a static instance that can be reused as many times as you wish, as there is nothing unique to each YieldOrContinue instance. You can of course create and use a new instance of YieldOrContinue, however that would be generate garbage and be a waste of resources.