1
\$\begingroup\$

I didn't understand this point yet. for me its complicated. What i'm trying to do is a level as loading scene work to appear before load the game level. when loading progress bar complete you have to press any button to play the game. Here is my script:

// game level01
// game level02
// loading scene

 public float progressBar;
 public void nextlevel() // this for button
{
 LoadNextLevel();
}


IEnumerator LoadNextLevel()
{
    AsyncOperation async = Application.LoadLevelAsync("level02");
    yield return async;

}

Example from "ninja gaiden black". when you select any level to play. loading scene show up. when complete loading the level. new word appear inform yo to press X to play. enter image description here enter image description here

\$\endgroup\$
1
\$\begingroup\$

There are lots of options to do this, here's one:

Have a 'loading screen' scene (or prefab) that contains the progress bar, and load that one before you do your actual loading. SceneManager.LoadSceneAsync can do your actual loading, with the additive loading mode - this way you can keep the button press screen there until they press a button. Once the button is pushed you'd disable or destroy the 'loading screen' contents.

Note that LoadSceneAsync returns an object that has a progress variable, that can be used to progress the loading bar (however, In my experience it's not fully accurate and the value may need some tweaking).

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ OK. give me some code lines please. \$\endgroup\$ – user43474 Oct 29 '16 at 4:08
  • \$\begingroup\$ I'm not sure what "please" was going to help there. \$\endgroup\$ – sehe Oct 29 '16 at 20:14
  • \$\begingroup\$ what can I do ? Its confused to me. There is no single post about this ! I got tire from searching and I hope some one can give me a correct answer about this. \$\endgroup\$ – user43474 Nov 1 '16 at 3:21
  • \$\begingroup\$ @user43474 Which part are you getting stuck on? \$\endgroup\$ – CiscoIPPhone Nov 1 '16 at 15:38
  • \$\begingroup\$ The loading scene. I don't know where I should put it ? look at this script: s21.postimg.org/ess1km0mf/… or link. When i press on the button i have to wait until it complete, then i have to press on "A" to open level one. I don't know where i should add the loading scene ? \$\endgroup\$ – user43474 Nov 1 '16 at 18:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.