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
2
Question by lifeisforu · Oct 22, 2016 at 05:43 PM · prefaboptimizationmemory management

Prefab with UI.Text is not unloaded

I'm doing optimization test to reduce memory usage.

When I destory all prefab-instances, there is a case that prefab is not unloaded as if there are undestroyed prefab-instances.

I realize a prefab couldn't be unloaded when a prefab-instance has references for other assets using public field.

So, I removed references by setting them null in OnDestroy() event.

It seemed to work very well. But I realized there is another case making prefab cannot be unloaded.

If there is a GameObject with a UI.Text component, that prefab will be never unloaded.

alt text

How could I fix this problem?

textmemoryleak.png (29.0 kB)
Comment
Add comment · Show 3
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 carldevelopsforcoffee · Sep 21, 2017 at 07:31 AM 0
Share

I have the same issue, tried moving the font of the UI.Text to resources to see if it was an issue with Resources.Load but the problem remains. Hope someone can fix this.

avatar image hexagonius · Sep 22, 2017 at 08:19 AM 0
Share

I'm a little confused about what you mean. You say "with UI.Text the prefab will never be unloaded". The screenshot shows "With Text, Texture2Ds are unloaded", but are visible within the memory sample.
Can you explain again what exactly the problem is?

avatar image carldevelopsforcoffee hexagonius · Sep 23, 2017 at 07:27 AM 0
Share

Sorry, my issue isn't related to the screenshot (but similar). $$anonymous$$y issue is a prefab with UI.Text, when loaded thru Resources.Load() will NOT unload properly. The prefab will show in the memory profiler even after Resources.UnloadUnusedAssets() is called.

Still trying to figure out the cause, Im suspecting the font (in Assets/Fonts) used by my prefab(in Resources) triggered something in Unity to keep a static reference of the prefab.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by lifeisforu · Sep 22, 2017 at 09:30 AM

My mistake. It means if you delete prefab instance with text, it's texture will never be unloaded. I guess the situation occurs because of text atlas for the text.

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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

Maximum RAM memory exceeded causes app to crash in iOS 1 Answer

structuring large games / scenes / prefabs 1 Answer

Scene generation question 0 Answers

Is Destroying GameObjects bad for optimization ? 1 Answer

Ways to minimize Object.stelemref() calls (low level) 1 Answer


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