- Home /
C# version of yield when loading a scene?
I found this example in the Unity reference manual, but its only Javascript.
function Start ()
{
// Start streaming the data file
var stream =
new WWW ("http://www.unity3d.com/webplayers/Lightning/lightning.unity3d");
// Yield until stream is done
yield stream;
// Load it!
stream.LoadUnityWeb();
}
I've tried to convert it into C#
But I cant get the stream and the yiekd to work? what am I missing here?
I would like to be able to load other unity3D files from a webserver to add new levels.
Answer by ckfinite · Jun 21, 2011 at 02:23 AM
Well, the second example is somewhat enlightening. Basically, what you could do is spawn off a web coroutine that uses this:
while (!stream.isDone) {
yield return null;
}
It might be possible to yield return stream though, have you tried it?
Your answer
![](https://koobas.hobune.stream/wayback/20220612113258im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Issue with yield instructions in C#. 1 Answer
How to change a Texture with a Delay 1 Answer
JS Wait for a function to complete - no WaitForSeconds 1 Answer
How can I make a variable false for a period of time? 3 Answers
Coroutines and states 1 Answer