I'm aware that having a large initial level in Unity causes the iPhone/iPad to shut down the app before it is done loading. The solution, I thought, would be a loading level that yields for 1 or 2 frames and then proceeds to load the next level.
functon Start()
{
yield;
Application.LoadLevel(1);
}
This doesn't seem to work for some reason. Both scenes are setup correctly in the bu开发者_JAVA百科ild window of Unity, and in Xcode no errors occur.
Anyone have any suggestions that I may persue?
functon
is not a valid keyword here.
Assuming that this is a cut & paste mistake, make sure of the following things:
- you have at least two scenes in your build settings
- it works in the editor (load the scene 0 in the editor and press play)
- you've added your script to an object in the scene '0'
Also, I suggest using scene names instead of scene index when calling Application.LoadLevel
.
For example, you could have a scene called "Preload" and another called "Menu". Your "Preload" scene would be the first one in your build settings. The call would then be:
Application.LoadLevel("Menu");
Which is less error-prone if you reorganize the order of the scenes in the build settings, especially once your project starts getting bigger.
精彩评论