Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: mimmog on October 05, 2014, 12:48:46 PM

Title: How to make scene loading ?
Post by: mimmog on October 05, 2014, 12:48:46 PM
Is possibile to create a loading screen for scenes with NGUI ? I would like also only the text "Loading..." without progress bar...I have not Unity Pro and I can't use Application.LoadLevelAsync and similar.

PS: It's enough also only a loading screen when the game start and to load all game's assets.

Thank you
Title: Re: How to make scene loading ?
Post by: ArenMook on October 06, 2014, 08:44:25 AM
Make a UI window that says "loading". Instead of just doing Application.LoadLevel, open that window first, yield until next frame, then do Application.LoadLevel.
Title: Re: How to make scene loading ?
Post by: mimmog on November 29, 2014, 09:19:42 PM
Like this?

  1.  
  2. VisualLoadingScreen();
  3. yield WaitForEndOfFrame();
  4. Application.LoadLevel("1level");
  5. DisableLoadingScreen();
  6.  
Title: Re: How to make scene loading ?
Post by: ArenMook on November 30, 2014, 05:50:57 AM
WaitForEndOfFrame() is still the same frame. "yield return null;" would wait for the next one.
Title: Re: How to make scene loading ?
Post by: mimmog on November 30, 2014, 11:59:39 AM
No, not work fine... :( this is the code :

  1.  
  2. public void loadLevel(int numL){
  3.                 string levelName = "Level_" + numL;
  4.                 setLevelInfo (numL);
  5.                 StartCoroutine(waitLoading(levelName));
  6. }
  7.  
  8. IEnumerator waitLoading(string levelName){
  9.                 NGUITools.SetActive(menuLoading,true);
  10.                 yield return null;
  11.                 Application.LoadLevel(levelName);
  12.                 NGUITools.SetActive(menuLoading,false);
  13.                
  14. }
  15.  

The problem is that It not show the menuLoading but if I delete the row NGUITools.SetActive(menuLoading,false); the menu is showed..why it not wait for NGUITools.SetActive(menuLoading,false); ?
Title: Re: How to make scene loading ?
Post by: ArenMook on December 02, 2014, 11:16:05 AM
You would need to wait for the level to load instead of executing the code right away. Check Unity's documentation for Application.LoadLevel, this isn't an NGUI question at this point.