Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 Heino · Feb 05, 2016 at 04:15 PM · texturememoryresourcesunloadingunloadunusedassets

Issues with unloading textures and atlases

We seem to be having some issues with Unity not unloading textures (and other assets) that are no longer in use. During the development of a previous project in Unity 4.x, I created a tool that reports the amount of textures, meshes, materials, sounds, etc., using the Resources.FindObjectsOfTypeAll method. This tool seemed to work nicely in Unity 4 and helped us track down memory leaks in our previous project. I hope this method still works as it did back then? We are now in Unity 5.2.4.

To explain in a bit more detail what is going on, our game loads new scenes by first fading out, showing a load screen and then 'behind the curtains' load an empty scene, in which we call Resources.UnloadUnusedAssets () and System.GC.Collect (). After this the game loads the actual scene that was requested. The problem is that it seems unused assets are not being unloaded in this process. We have a main menu scene with some buildings in it, but upon loading any of the actual gameplay scenes, the meshes and textures used on the buildings in the main menu scene are still loaded, at least according to FindObjectsOfTypeAll. Same issue when we return to the main menu after having been in any of the gameplay scenes: A lot of the assets used in the gameplay scene are still reported as being loaded.

I know that if just one object somewhere references a prefab or is linked to a texture or anything like that, the asset will remain in memory, but I can't find anything in our gameplay scenes that should be referencing assets from our main menu. It might be that we are, but I just can't find it, so I'd like to confirm that this is not a known issue with Unity 5.x.

Another thing is that according to the tool I made, it seems that various texture atlases, created with Unity's SpritePacker, are loaded multiple times. My tool looks through the loaded assets and counts assets with the same name and some of the sprite atlases (textures starting with 'SpriteAtlasTexture') seem to be appearing multiple times in the list. Is there a reason for that? It also seem to load texture atlases that aren't used.

Comment
Add comment
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

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Can we unload NavMesh in runtime? 0 Answers

Loading a Random Resource in a Folder Without Using Resources.LoadAll 0 Answers

Question about asset memory not freed after calling SceneManager.UnloadSceneAsync() 0 Answers

Memory problem. How do I dump a Streaming Asset from memory? 1 Answer

Unable to free resources from memory 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