4

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 build window of Unity, and in Xcode no errors occur.

Anyone have any suggestions that I may persue?

user3071284
  • 6,955
  • 6
  • 43
  • 57
Zophiel
  • 129
  • 2
  • 12
  • I've used this technique in the past and it definitely does help on devices that load slower (iPhone 3g and lower). – Calvin Apr 14 '11 at 15:49

1 Answers1

1

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.

yome
  • 31
  • 1
  • @yoma All great advice indeed, but all of which i sadly already applied prior to posting ;( And it wasn't a copy/paste mistake, i just typed it out here. Not sure why it isn't loading on the device. works fine in the editor. No errors in xcode either. I am using WWW in the other scene to get a tweet feed, perhaps it's that. – Zophiel Apr 15 '11 at 07:05