unity

0

Please login or register to vote for this query.

(click on this box to dismiss)

DevOps Meta

Q&A about the site for software engineers working on automated testing, continuous delivery, service integration and monitoring, and building SDLC infrastructure

-- SELECT TOP 1 Id, Title, AnswerCount, AcceptedAnswerId, Tags, Score, CreationDate, Body FROM Posts WHERE PostTypeId = 1 AND Tags LIKE '%<unity-game-engine>%' AND Score > 100

/*
12932306
How does StartCoroutine / yield return pattern really work in Unity?
8
32469037
<c#><unity-game-engine><coroutine>
159
2012-10-17 10:30:48
<p>I understand the principle of coroutines. I know how to get the standard <code>StartCoroutine</code> / <code>yield return</code> pattern to work in C# in Unity, e.g. invoke a method  returning <code>IEnumerator</code> via <code>StartCoroutine</code> and in that method do something, do <code>yield return new WaitForSeconds(1);</code> to wait a second, then do something else.</p>
<p>My question is: what's really going on behind the scenes? What does <code>StartCoroutine</code> really do? What <code>IEnumerator</code> is <code>WaitForSeconds</code> returning? How does <code>StartCoroutine</code> return control to the "something else" part of the called method? How does all this interact with Unity's concurrency model (where lots of things are going on at the same time without use of coroutines)?</p>
*/

SELECT Id, Title, Score, CreationDate, Body FROM Posts WHERE Id = 32469037

Enter Parameters

Options:
Switch to main site
loading Hold tight while we fetch your results