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 DaJuice · Mar 01, 2013 at 02:14 PM · iostexturememoryprofileratlas

Textures/Atlases and memory management

I've been making a game for 5 months now, following what the profiler tells me, but I've been told that the unity profiler is kind of unaccurate, but I never thought it would be so much.

I've just started using Instruments for iOS andI've discovered that (on iOS at least) the profiler is completely irrelevant, or that I'm doing something very wrong, I'm asking you this to make sure I'm not doing something wrong.

The game we're making is really texture heavy (we have over 30 jam packed atlases, most of 'em 1024x1024), at the title screen, the unity profiler tells me it uses about 20MB, the Instruments profiler tells me 90MB. What I understand from that, is that the unity profiler hides the textures that are currently used but not on screen from the memory profiler.

This means that the unity profiler tells me that only the title screen is in memory and my other textures are somehow compressed, ready to be used, but in fact my whole UI is loaded with all it's textures fully uncompressed.

Now that is some hope of not having to heavily manage those textures gone, but I'm telling myself that there must be a reason why the profiler tells me that they are automatically managed?

So is there some magic incantation to make in order to make this automatic textures management work, or do I have to manually manage those?

Comment
Add comment · Show 5
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 mgoi.tbgames · Mar 01, 2013 at 04:14 PM 0
Share

The answer is: It depends.

How are you loading the textures? AssetBundles, WWW class (no AssetBundles), Resource directory or are they part of a scene?

avatar image DaJuice · Mar 01, 2013 at 04:15 PM 0
Share

For this situation, they are part of the scene

avatar image mgoi.tbgames · Mar 01, 2013 at 04:22 PM 0
Share

I guess this is the reason you require that much memory. Unity loads the complete scene to memory. If you want to prevent this you have to load the assets on the fly.

Put them in a folder and load them via WWW class or the Resource class. $$anonymous$$eep in $$anonymous$$d that you have to dispose textures manually if they are no more needed (Object.Destroy()) otherwise the memory is not released.

Sometimes it helps to call Resources.UnloadUnusedAssets to free the memory.

avatar image DaJuice · Mar 01, 2013 at 04:31 PM 0
Share

Thanks for confir$$anonymous$$g this, it is just that I feel betrayed by the unity profiler who told me that even when I have many atlases used in my scene, only the ones I currently see are "uncompressed" or use space in RA$$anonymous$$, so there is really no trouble in not managing memory, but I guess I'll have to rethink my strategy.

avatar image mgoi.tbgames · Mar 02, 2013 at 08:23 PM 0
Share

You're welcome. In the last years I also had to learn that you should never rely only on the profiler or the memory functions unity offers. $$anonymous$$any memory issues are just not covered.

Some tipps on memory usage:

  • Always have a task manager or other memory tool running

  • Write code in an unmanged style (clean up your instances properly, null object, remove event handlers, ...)

  • Restart the editor if you think some memory corruption occured

  • Free static objects on you own or they might remain in memory when loading an other scene or leave the play mode

  • Do not load to many resources at the same time to prevent fragmentation

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.

Follow this Question

Answers Answers and Comments

10 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

Related Questions

Determining Texture Memory Usage 2 Answers

TEXTURE has wrong size in memory 1 Answer

Why are compressed textures showing up huge in memory? 0 Answers

Changing textures accumulate in memory. iOS. 0 Answers

SpriteAtlas clone memory problem 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