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 Jessespike · Sep 13, 2012 at 08:49 PM · scenecrashloadhang

Unity takes forever to load scene

Using Android 2.3.x, 512 MB of memory

I have a mobile game that has a couple of scenes. I can load each scene and play the game for a while. But if I continue to reload scenes/levels. The game will eventually hang, and never finish loading the next scene.

I removed every script incase I had a memory leak or reference issue. But it still hangs. When it is "hanging", logcat spams this:

 E/Unity ( 7659): Inflate Error: invalid code lengths set
 E/Unity ( 7659):
 E/Unity ( 7659): (Filename: ./PlatformDependent/AndroidPlayer/ZipFile.cpp Line: 234)
 E/Unity ( 7659):
 E/Unity ( 7659): Inflate Error: invalid code lengths set
 E/Unity ( 7659):
 E/Unity ( 7659): (Filename: ./PlatformDependent/AndroidPlayer/ZipFile.cpp Line: 234)
 E/Unity ( 7659):
 E/Unity ( 7659): Inflate Error: invalid code lengths set
 E/Unity ( 7659):
 E/Unity ( 7659): (Filename: ./PlatformDependent/AndroidPlayer/ZipFile.cpp Line: 234)
 E/Unity ( 7659):

Looks like a Unity error related with loading assets.

I will receive low memory warnings before the hang happens. I check the memory left and it seems like I have alot left (100+ MB?). Maybe there is a buffer overflow somewhere? So far my best solution is to combine every scene and remove every non-essential asset (Or else I will run out of memory), so I never have to reload a scene. But I don't think I should have to do this. I tried the empty scene as a loading screen idea but that had no improvements. If I remove assets (textures, meshes, etc) from the scenes. I can reload the scenes many more times. But it doesn't matter what's in the scene. A crash is guaranteed.

I made a test project, included a empty loading screen scene and a basic scene with a textured cube. After a while, the scene will fail to load and Unity won't do anything but spam that error, the only thing I am able to do is to kill the process (or quit application). I can only kill the process if Unity is trying to loading asynchronously, if loading scene normally, the game will seem like it is frozen.

I do not believe that I am the only person in the world that has encountered this problem. But I am also completely lost and have no idea where to go from here. Any ideas? (Even accepting crazy ideas at this point!)

Comment
Add comment · Show 3
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 Alex in Bris · Oct 29, 2012 at 07:39 AM 0
Share

I've just run into this same issue, did you guys ever find a solution for this? I'm using the exact same platform (Android 2.3.x 512$$anonymous$$B).

At first I thought it was an error in my scripting and looked for something going wrong in the Async loading, but no errors were being thrown and it just seems to hang with the async operations '.progress' value holding on a certain percentage and the '.isDone' value always returning false.

But I started looking deeper and found much of the same behaviour and then came across your post. Were you guys able to work it out?

Thanks for any help.

avatar image Jessespike · Oct 29, 2012 at 08:16 AM 0
Share

Never actually solved the issue, but I did discover a messy work-around. I'm still not 100% on what the problem is, while researching I discovered that the memory heap can get fragmented and then after so many loads, your game may hang. So what I did was $$anonymous$$imize all loading. I jam-packed as much as I could into one scene, loading some extras additively. Now when I need to load a new scene, I just LoadLevel my giant scene and I have a script that toggles chunks on/off depending on what game level I want to load. I find this doesn't really unload/load anything, more or less resets the current scene. Like I said, it's messy. I basically load everything once and hide it, or as much as I can before the game crashes on the first load. I don't like this method, but this is the best solution I have found so far... Hope this helps. Let me know if you find anything :)

Edit: Also reducing the amount of memory required for the entire game/per scene helped get more loads in before it ultimately hangs itself.

avatar image Alex in Bris · Oct 29, 2012 at 11:09 AM 0
Share

Hey thanks for the quick reply! Yes this has definitely helped out thanks :D

$$anonymous$$emory heap can get fragmented from loads, cool I'll keep researching too. I see what you mean that does make sense to avoid level loading where possible too.

And I agree that less memory helps out, I'm working on a test project with 3 levels at the moment where the first 2 levels are quite small and the third level is a big one, and more often then not the third level will usually be where it hangs.

Do you think using 'additive' level loading may remove the problem? Because one thing that I was thinking it might be is normal level loading handling both unload and load processes that overlap; like the unloading and loading code is trying to access the same operations from Android at the same time and ending up waiting forever for each other

I might test this out by manually Destroy()ing objects of the previous level and then try to load the next level with additive loading.

I might call it a day here though for me, but I'll be back onto this tomorrow so I'l let you know for sure if I find out anything new.

Thanks a lot for the feedback Jessespike, this one is a real headache :S

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by goodhustle · Sep 14, 2012 at 12:07 AM

Looks like a bug, send in your test project and see if they can track it down.

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

13 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

Related Questions

Webplayer hangs on loading scene 2 Answers

I cant load my scene? 0 Answers

The best way to load scenes ingame 3 Answers

Unity crashing when loading scene 1 Answer

Load Custom Scene 2 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