• 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
Question by PsychoDuckArcade · May 09, 2016 at 11:39 PM · androidcrashresourcesresources.loadram

Resources.Load too much on Android = crash.

I resources.load about 500 objects at the beginning of my game. Each is about 8kb, and each comes with an image about 200kb. Profiling, the total amounts to about 100mb ram usage, my entire game about 200mb total ram usage.

My android phone has 1GB ram, nothing else running to hog memory. The game works fine if I Resources.Load a smaller number of objects (tested with 50), but if I try to load all of them at start the build crashes after launch. It loads all of them fine on PC, just not on Android.

Is there some sort of secret ram usage limit I don't know about?

I know I could just not load all resources at once, loading and unloading as needed, but I intended to use all objects simultaneously in game (eventually). I just need to know if this should be possible before I start investing time in alternatives. If so, why isn't it working? And how do I fix it from crashing?

EDIT: I'm not even resource.loading the images, only the prefabs that reference them, so I doubt they're the issue. I compressed them recently to be sure, from ~200kb each to ~50kb each. Didn't make a difference. Next I could test loading the objects without any components at all, and see if it's a component or just loading the gameobjects (already pretty sure it's the latter).

There's something about Resources.loading 500 (lightweight objects) on mobile that causes the app to minimize on Android devices while loading. Tabbing back to the app just loads and minimizes again. The unity profiler says the game uses ~200mb of ram, barely any rendering, and like not even 2% cpu usage. Everything else is nothing. Which makes sense.

Idk if this is a performance issue or not, it only happens when I load a lot of these objects, but the end performance hit is still so small idk why it would crash from it. The only performance hit that isn't super light is ram usage, but 200mb on a 1GB phone, idk what the problem is.. I'm so confused. :(

Comment

People who like this

0 Show 9
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 Highwalker · May 10, 2016 at 05:51 AM 0
Share

What kind of objects are they? If they're mostly all from the same prefab, pooling might be a better option.

avatar image PsychoDuckArcade Highwalker · May 10, 2016 at 03:22 PM 0
Share

They're 500 unique prefabs. I'm not instantiating them, just loading them with resources.load. Each is 8kb, and each has a different png image about 50kb each (compressed them recently).

avatar image Highwalker PsychoDuckArcade · May 10, 2016 at 06:24 PM 0
Share

Geeeeez..... That's a lot of prefabs :O

And loading them normally as you need them is too slow?

Also, did you put the PNG files in an atlas? Assuming you're using them as sprites?

Show more comments
Show more comments
avatar image PsychoDuckArcade Highwalker · May 11, 2016 at 08:48 PM 0
Share

All 500 objects are eventually going to have different properties, they're not all the same object. For now they're all just sprites for testing purposes.

avatar image Highwalker PsychoDuckArcade · May 11, 2016 at 09:14 PM 0
Share

Well, then I can't really help you mate. Sorry. Try putting the sprites in an atlas and see if that helps. Otherwise I would just load the objects as they're needed.

0 Replies

· Add your reply
  • Sort: 

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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

69 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 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 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

Lot of resource files 1 Answer

ridiculous load time using Resources.Load() on android build 2 Answers

Unity Android game crashes when reopened from the home screen. 3 Answers

Android , not working 4 Answers

Unity crashes after splash screen on Android 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