Application.LoadLevel() won't work in Xcode.

Hello everyone!

I am new to unity, Xcode and this community, so here is one silly problem:

I am planning to switch one level to another, by using this function Application.LoadLevel(). There is no error in unity, but if I try to run the programm in Xcode, Xcode throws out 10 yellow and 201 red issues. I am pretty sure that this build failure in Xcode is caused by this function, because if I remove the line this function belongs to, the Xcode will build successfully.

I have googled like “unity xcode load level”, but didn’t find anything useful, maybe because my Xcode knowledge is so few that I can’t understand those web pages.

Can anyone kindly explain this problem for me?

BTW, I'm using unity 3.5.3f3, Xcode 4.4, and iOS 5.1, if it helps.

When you built your project in Unity did you add all the scenes you want to use in the build settings?

Thank you guys! This was really a silly problem. I was using multiple iPads for testing, changed devices during the Xcode runs, thus sometime my Xcode built app on iPad, sometime it built onto simulator. The simulator would fail and throw out 201 issues because the unity build was not based on simulator.

2 Answers

2
  1. Check the build setting in unity…
  2. set appropriate scene sequence
  3. Set Proper navigation according to your Requirement
  4. And i think your issue will be solved…

@WilliamBerne by saying navigation i was saying that the flow of navigation means by clicking certain button level 2 will be loaded or 3 as per your requirement ...... Sorry for the bad english....

and one more thing it will be more helpful if you could post your script here......is Application.Loadlevel(1) is working fine in unity?

have you tried Application.Loadlevel(x);.... here x should be replaced by the number of your scene....for checking the number go to build setting......

Thank you guys. Problem is still there.

@Maulik2208
Which settings are you talking about?
Scene sequence is fine.
What do you mean by navigation?

@SolidSnake
This is how I am testing now:

I created 2 new scenes, test_1 & test_2.
There is only 1 cube and 1 main camera in test_1, and the only one thing in test_2 is its main camera.
the only script in test_1 is attacked on the cube:

function Start ()
{
yield WaitForSeconds (5);
Application .LoadLevel(“test_2”);
}

At one point, this thing was successfully ran in Xcode. And it also worked on iPad.
After had that little progress, I added [ Handheld.PlayScreenMovie(“movie”, Color.black, FullScreenMovieControlMode.CancelOnInput); ] on top of [ Application .LoadLevel(“test_2”); ], this thing began to fail again. Even after I deleted the play movie codes, the programm still couldn’t be run successfully again.

Now I have really no one clue. How about you?

This isn't an answer, please update your original question.