Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 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
3
Question by Thomas 6 · Apr 05, 2011 at 04:05 PM · animationbugfreezeloadlevelasync

Application.LoadLevelAsync not working in Unity 3.3 Pro?

Hi everybody,

I've been looking for some answers for a moment now, and a lot of people seem to have this problem, but I never found any correct answer to that.

Basically I just use the code found on the Application.LoadLevelAsync doc page

AsyncOperation async = Application.LoadLevelAsync("MyBigLevel"); yield return async; Debug.Log("Loading complete");

It does load the level correctly, but it actually doesn't do anything different than the simple Application.LoadLevel; by this, I mean that I'm willing to have a user-friendly animation playing while my level is loading, and it doesn't. Even using the asynchronous loading, the scene just freezes until the new one is loaded.

In addition, I want to state that no, the scene being loaded is not heavy at all, so it can't come from a long initialization post level loading.

As stated earlier, a lot of people are complaining about that and there is never any answer given, so is it just a bug of Unity's last version or what?

Thanks.

Comment
Add comment · Show 1
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 cregox · Oct 10, 2011 at 05:36 PM 0
Share

Have you, by any chance, found a solution to this issue? - plus, postouros related: http://answers.unity3d.com/questions/61598/how-to-preload-a-scene-with-progress-bar-so-it-can.html

6 Replies

· Add your reply
  • Sort: 
avatar image
3

Answer by Jeston · Apr 05, 2011 at 04:10 PM

Mine seems to work fine and I am on iphone, but I have all the gameObject's turned off in the next scene so as not to fire the Start() on all their scripts which have heavy work loads.... Here is how I do it, where LoadingScreen has a bunch of animated sprites

// call back from a button public void AcceptMission() { LoadingScreen.gameObject.SetActiveRecursively(true); SettingsPanel.gameObject.SetActiveRecursively(false); MissionScreen.gameObject.SetActiveRecursively(false); AcceptMissionScreen.gameObject.SetActiveRecursively(false); StartCoroutine(LoadHangarAsync()); }

 private AsyncOperation LoadingHangarOperation;

IEnumerator LoadHangarAsync() { yield return new WaitForSeconds(1.5f); LoadingHangarOperation = Application.LoadLevelAsync("HangarRetina"); while (!LoadingHangarOperation.isDone) { yield return 0; } }

Comment
Add comment · Show 5 · 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 Thomas 6 · Apr 06, 2011 at 07:45 AM 1
Share

Still not working... The only difference between yours and $$anonymous$$e at the moment is that you turn off the gameobjects of the next scene; so I guess the problem comes from here. Though in that case I don't see the point of LoadingLevelAsync() as you actually do all the loading (understand here the activation of your gameObjects that you turned off) afterwards, which just delay the problem. Furthermore, in order to do that, I would have to create all my objects from my next scene into my menu scene, in order to be able to deactivate them, and thus would have a heavy loading at he app start...

avatar image cregox · Mar 07, 2012 at 07:13 PM 0
Share

Unlike with $$anonymous$$, this solved my issue!! We replaced yield return async; for the line here advised while (!async.isDone) { yield return 0; } and unity stopped crashing!!! Thanks, Jeston!

avatar image rbisso · Aug 27, 2012 at 11:49 AM 0
Share

Seriously... the whole engine stopping while LoadLevelAsync is loading my next level is driving me insane. Has anyone found a solid answer for this? It seems like all these discussions just fizzle out.

Here are the specifics of my case:

  • Using Pro

  • Running on Android

  • Don't have anything heavy in any of the start/awake functions of the scene being loaded

  • The old scene (with a progress meter, reading off the progress of the async operation), as expected, is still loaded while the async operation is underway, The progress meter, however, practically stops at like three frames per $$anonymous$$ute.

  • I put a debug.log msg on Update(), just to see what was going on... it ran about seven times, sporadically, during the ~30 second load.

  • I tried, as suggested, using

while(!asyncOpLvlLoad.isDone) { yield return 0; }

as opposed to just yielding the async op. No luck.

I'd really appreciate any help with this, what a pain in the butt.

avatar image vanofthedawn12 · Jan 20, 2013 at 11:21 AM 0
Share

Thank you for the trick sir!! but my problem is that the application kind of "Lags" when using the LoadLevelAsync... It feels like just using the normal loadlevel.

when I check the "progress", it always logs "1" no luck of using it to Lerp the position of my progress bar.. :(

avatar image cregox · Jan 21, 2013 at 01:13 PM 0
Share

@vanofthedawn even in Unity4, loadlevelasync doesn't work on Editor. Compile and test it, it should work.

avatar image
1

Answer by Bunny83 · Oct 10, 2011 at 05:49 PM

Well, i haven't used Application.LoadLevelAsync yet, but the only thing that comes to my mind is that you forgot to mark your GameObject with DontDestroyOnLoad. When the loading is finished it will destroy all objects that are not marked with DontDestroyOnLoad and therefore your coroutine will just be erased. Don't forget that coroutines run on a MonoBehaviour-script instance. If the script is destroyed the coroutine will be removed as well.

Comment
Add comment · Show 1 · 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 cregox · Oct 10, 2011 at 06:04 PM 0
Share

This is a great insight, but I'm having a very similar issue as $$anonymous$$ and even usin DontDestroyOnLoad won't make my animation run nor even debugging messages appear properly while loading.

avatar image
1

Answer by ryanmillerca · May 21, 2013 at 08:23 PM

It's been a few years since you asked, but just in case someone is still looking:

http://answers.unity3d.com/questions/338000/the-solution-to-asyncoperationprogress.html

This page solved the problem. The issue is that AsyncOperation.progress can get rounded to 0 or 1 unless handled carefully. The person in the link simply multiplied the value by 100f.

Cheers. -Ryan

Comment
Add comment · Show 1 · 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 rbisso · May 21, 2013 at 08:25 PM 0
Share

Thank you, Ryan!!! I'll give this a shot, it still wasn't working for us.

avatar image
0

Answer by Varnae · Apr 12, 2011 at 08:11 PM

I agree! I've tried to track the progress of the AsyncOperation and it goes from 0 straight to 1. I have a bigger scene that I am trying to load. There's no way an async load on it should go from 0 to 1. Anyone know what's going on here?

Comment
Add comment · Show 3 · 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 equalsequals · Apr 12, 2011 at 08:27 PM 0
Share

Jumping from 0 to 1 has been a known bug since like v2.6, it still loads the level, just doesn't accurately report the normalized progress. This pretty much kills the ability to do progress bars, but the isDone property will be accurate in reporting that the async operation finished. ==

avatar image Thomas 6 · Apr 13, 2011 at 07:22 AM 0
Share

Well it seems to me that ins$$anonymous$$d of just killing the ability to do progress bars, it's killing the entire concept of asynchronous as in the end it just does the same thing as the usual LoadLevel() (unless there is something I missed)

avatar image rbisso · Oct 21, 2012 at 06:39 PM 0
Share

I have also found this to be the case. Is it reported as a bug?

avatar image
0

Answer by wushuang212 · Oct 20, 2012 at 09:06 PM

I am searching the answer anywhere, but get nothing now, waha

Comment
Add comment · Show 1 · 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
  • 1
  • 2
  • ›

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

6 People are following this question.

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

Related Questions

Animation stops in Game window if animated object is not visible in Scene window 0 Answers

Unity3D freezes on Debian Linux 1 Answer

AnimatorOverrideController runtime sprite problem 2 Answers

4.3.2 AnimationWindow Bug? 0 Answers

Sprite animation is not updating (possible bug) 1 Answer


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