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 rival_mob · Jun 09, 2014 at 09:25 PM · 2d-gameplaymemory managementmemory usage

How to reduce memory usage?

Hi, I'm working on 2D game using Unity 4. Last time after adding new animations and textures my game stopped working on most of android devices. For now, I know it works only on Samsung Galaxy and maybe on other fancy smartphones but I'm not able to check it. When I run it on desktop it uses almost 2GB of memory during loading and 1GB during gameplay. This is really suprising because my game is pretty simple. Not much code, few animations and sprites + Physics2D.

So my question is how this high memory usage is possible? What am I missing? What can I do to reduce memory usage? I know I can compress the textures and animations but still I can't believe that 15MB app uses 2GB of memory. I just started my work with Unity and for now I'm out of ideas. Any help?

Comment
Add comment · Show 4
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 LMan · Jun 09, 2014 at 10:26 PM 1
Share

Are you using any audio? some of the settings for audio files can have a huge overhead.

How big are your textures? You can usually compress textures down quite a bit in the unity import options before it shows.

Too many draw calls can also bog down performance. Packing tons of stuff into sprite sheets can really save on draw calls, but of course the larger the sheet, the more texture memory it takes up.

$$anonymous$$ake sure you limit your OnGUI calls- usually you can keep objects with scripts that call onGUI deactivated until you need them.

Avoid instantiating/destroying lots of things. Use the Object Pool pattern for things like that ins$$anonymous$$d.

If none of the above help, could you post a screenshot of the stats tab from in Unity with your game running?

Or even better, deactivate things one at a time and see if you can't nail down which objects are causing the biggest draw on your performance.

avatar image rival_mob · Jun 11, 2014 at 06:59 PM 0
Share

But the problem is that I get big memory usage when Unity splash screen shows and then app just shuts down.

I don't use any audio for now.

avatar image Jeff-Kesselman · Jun 11, 2014 at 07:10 PM 0
Share

if you have Unity Pro, use the profiler to see what is using the most memory.

It could be almost anything...

avatar image rival_mob · Jun 11, 2014 at 07:19 PM 0
Share

Problems started after adding animations so I'll try reduce textures size and pack animation frames into sprite sheets.

I don't have Unity Pro for now.

1 Reply

· Add your reply
  • Sort: 
avatar image
2

Answer by dsada · Jun 09, 2014 at 09:57 PM

when i had this problem. The problem was i created a lot of new object in Update(), OnGUI() functions. Like textures, GUIStyles, etc.. As it seems, GC cant handle that. Hope this helps.

But of you have PRO the profiler can easily tell you where the problem is

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

25 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

Related Questions

WEBGL Memory Usage Problem 1 Answer

Is this memory usage too much for a mobile game? 1 Answer

Question About Camera's, Canvases and Memory 0 Answers

Reduce GPU Memory usage from textures 1 Answer

Reducing memory in voxel game 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