I need to load a large number of texture files and map them onto an sphere to create gameobjects during the startup of my game (making lots of planets).
If I create these planet gameobjects in a loop in a script does the frame rate for unity go to zero while the loop is executing?
If I want to show an animation of a loading bar or something else how would I do this?
Would I have to load my planets in small batches?
I have not tried this in unity before but I used it in XNA a lot. You can use System.Threading.Thread to run the loop. All you have to do is create a void Function() method and put your loading code in there. Then initialize the thread in the Start method passing your Function method into the constructor. Then call Thread.Start() to begin the execution.
Once again I have not used this in unity so I’m not 100% sure this will work but its simple enough to give it go. Hope that helps.
I believe that this may help you.
Unity - CREATING A SCENE SELECTION MENU
You’ll most likely be needing to look at Application.LoadLevelAsync but this requires Unity Pro.
“Unity will completely load all assets
and all objects in the scene in a
background loading thread. This allows
you to load new levels while still
playing the current one, show a
progress bar or create a completely
streaming world where you constantly
load and unload different parts of the
world based on the player position,
without any hiccups in game play.”
Hope this helps!