Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by konsnos · Nov 29, 2014 at 10:23 AM · asyncloadlevelasync

LoadLevelAsync doesn't work as it should

Hey all. I've tried to use LoadLevelAsync in order to show a loading progress, but unfortunately I don't see any progress. The Editor hangs while loading the next scene for more than a minute because the next scene is huge, and suddenly I get a progress of 1 from 0.

Here's my code:

 IEnumerator DisplayLoadingScreen ()
 {
     progressBar.value = 0;
 
     async = Application.LoadLevelAsync(SceneName);
     async.allowSceneActivation = false;
     while (!async.isDone)
     {
         progressBar.value = async.progress;
         UpdateText();
         if (async.progress >= 0.9f && !async.allowSceneActivation)
             async.allowSceneActivation = true;
         Debug.Log("I'm yielding at progress: " + async.progress);
         yield return null;
     }
 
     if (async.isDone)
     {
         progressBar.value = 1f;
         UpdateText();
     }
 }

The exptected result would be for the Unity editor to not hang, and show a progress of 1...2...3.. etc. Have I done anything wrong?

Thanks for reading.

Comment
Add comment · Show 2
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image konsnos · Nov 29, 2014 at 10:51 AM 0
Share

@pako Of course. It would throw an error otherwise.

avatar image konsnos · Nov 29, 2014 at 11:11 AM 0
Share

@pako the while loop is entered. That's why I have the Debug.Log("I'm yielding at progress: " + async.progress); I never said that it doesn't work. I said it doesn't work as it should. I go directly from 0 to 1, waiting for about 1 $$anonymous$$, for a huge scene to load.

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by konsnos · Nov 29, 2014 at 12:44 PM

Finally seems there wasn't problem at all. It hanged the Editor, but when built the project ran fine! Just leaving this here in case someone else has the same problem.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by J_Troher · Dec 08, 2014 at 01:31 AM

I'm having the problem, In Editor and In all builds. I have Pro.

     IEnumerator LoadLevel(){
         AsyncOperation async = Application.LoadLevelAsync ("Map1");
         while (!async.isDone) {
             loadProgress = (int)async.progress * 100;
             LoadingScreen.LoadingText.text = loadProgress + "%";
             LoadingScreen.LoadingBar.transform.localScale = new Vector3 (loadProgress, LoadingScreen.LoadingBar.transform.localScale.y, LoadingScreen.LoadingBar.transform.localScale.z);
             Debug.Log(loadProgress + "%");
             yield return new WaitForEndOfFrame();
         }
     }

The Debugs don't show up until the new scene loads.. I've even tried packing as much as I can into it to make it require some time to load, thinking maybe I'm just instantly loading.. but idk. Help would be awesome!

  • Also, I did use the code you posted as well, the only thing different from what I had was that you made use of allow scene activation. I tried with and without. It just chops for a second and switches to the next scene, then sends the debugs...

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

27 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

LoadLevelAsync / AsyncOperation, isn't helping scene transition 1 Answer

Loading Progress using UNET 2 Answers

Load level async freezing animation for several seconds 0 Answers

Loading a level and waiting for an input. 1 Answer

Display loading/progress indicator from Start()? 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges