- Home /
Resources.Load Instantiate Yield problems
I'd like to learn the proper use of yield.
I built a function to load two objects one after another. The objects are loaded from the Resources.Load then Instantiated. Then scripts are attached using addComponent. The problem is sometimes this works sometimes it doesn't load both objects. On the webplayer it does not, in the editor it does. Do I need to include some sort of yield instruction to make sure that one completes before the other one starts? Oddly throwing in something like yield WaitForSeconds(2) causes the whole function to do nothing? So I'm confused about how to use yield properly.
theobject = Resources.Load(otype);
go=Instantiate(theobject);
Thanks for any info.
Answer by Berenger · Jan 30, 2012 at 05:27 PM
About Resource Load and webplayer, take a look here.
About the coroutine, it's over there.
I can't help you further than that, I've never used Resource.LOad on a webplayer project.
The coroutine link was interesting. I still don't know why putting yield WaitForSeconds(1); after Instantiate prevents the object from loading. If I take it out the object loads fine.
Your answer
Follow this Question
Related Questions
Instantiate an object as soon as another object is destroyed 2 Answers
Destroy then Clone Help please? 2 Answers
How to make a loading feedback for big GameObjects loading? 2 Answers
Yeild and WaitForSeconds and Instantiate 1 Answer
Problem with missing texture with Instantiate( Resources.load ) method 0 Answers