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.