Yield until event in C#

The documentation states that a script can pass special values to the yield statement to delay the execution of the Update function until a certain event has occurred.

Can anyone point me to an example of how to do this in C#? I want to yield a scripts execution until it receives a single (from a SendMessage call)

I don’t think it is good practice to try and stop the execution of the Update() method because that is the main game loop in essence.

As a simple non-yield workaround couldn’t you just have a boolean flag on the script in question that does nothing in the Update if it’s not set?

Then that flag can be set by the method you pass into SendMessage().

Hello!

With a little search, you can find how the yield statement is used in C#, checkout this thread
http://forum.unity3d.com/viewtopic.php?t=31951&highlight=yeild+yield
hope it helps :wink:

Also, check out here in the documentation how they work with the yield statement :slight_smile: