- Home /
Question by
appminis-mike · Nov 10, 2015 at 04:44 PM ·
textmemory-leak
How do I avoid memory leaks when setting UI.Text.text?
I have a UI.Text that I need to change the text for, but every time I do I get a huge memory leak (like 1.3MB). I've tried using both static and dynamic fonts, using smaller font sizes, and destroying/recreating the UI.Text component each time, but nothing has helped.
Taking a memory snapshot, the memory accumulation is within Not Saved > Mesh > Shared UI Mesh.
How can I prevent this from happening?
Thank you.
Comment
Having the same problem. I resource.load a prefab with a UI.Image and a UI.Text, when I unload (Destroy + Resources.UnloadUnusedAssets), the texture of the Image remains. When I remove UI.Text from the prefab, everything unloads fine.