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 /
  • Help Room /
avatar image
0
Question by King-Klong · Nov 29, 2017 at 02:38 AM · assetbundlememory managementmemory-leak

Object pooling long list of icons - Loading/unloading textures

I'm working with a game that gets deployed to Android and iOS. We are currently using Unity 5.5.4.

\n

I'm creating a main lobby with a list of about 80 or so icons. Each icon having its own unique image on it. I want to use object pooling so that there are only 10-15 icon gameobjects at once. Existing gameobjects will be re-positioned and the scroll rect will be adjusted so that scrolling will be seamless. I have that part done and working great.

\n

My issue is with loading and unloaded the textures from the asset bundle. We've had issues in the past with Texture2Ds sticking around in memory unless we frequently call Resources.UnloadUnusedAssets() (which seems janky), and even then, some Texture2Ds will stick around in memory. We have our own asset system that manages everything, and it works pretty well, but isn't perfect obviously. Our system doesn't really handle what I want it to do in this situation, so I'm bypassing our system and loading the asset bundle myself and grabbing the assets I need.

\n

Right now, all images are stored as PNGs in the bundle. I load the bundle, then as my layout manager requests an icon (newly instantiated or reused), I call LoadAsset() and it returns a Texture2D. I cast this to a Texture and set it to my RawImage component on the Icon gameobject. While profiling in editor, all of the textures that were used but are now off-screen are still in memory and do not go away. The code is simple and I know for a fact there is nothing referencing them (profiler even reads a 0 count).

\n

Is there a better way to load these images? Or am I managing them wrong? I thought about managing a list of Texture2Ds and trying to stream the images from the bundle into the already allocated Texture2D with LoadRawTextureData(), but I'm not quite sure how I'd do that.

*PS: sorry for poor formatting, couldn't figure out how to add a line spacing...

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

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

Release memory in Addressable not working in webgl 0 Answers

Efficient ways to optimize the downloading and unloading of large textures? 1 Answer

Addressables: AssetReference Dropdown in Inspector Takes a Long Time To Appear 0 Answers

Unity asset bundles and additive scenes 0 Answers

Cannot Unload dependencies on a Prefab loaded by Unity Addressable System,How Can I Unload dependencies o a Prefab loaded by Unity Addressable System? 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