Tasharen Entertainment Forum
Support => NGUI 3 Support => Topic started by: dipu5683 on June 17, 2014, 06:13:12 AM
-
Hi
I have created two prefab say page1 & page2 . page1 uses atlas1 & page2 uses atlas2 .
Pag1 prefab is the child of UIRoot ( present in the scene from the start ) , And "mainmenu.cs" is attached to it.
following code has bee wrtten to load the page2.
method 1
GameObject ob = (GameObject)Instantiate((GameObject)Resources.Load("page2"));
ob.transform.parent = root.transform;
ob.transform.localScale = new Vector3(1f, 1f, 1f);
method 2
NGUITools.AddChild(root.gameObject, page2);
and to destroy the page1 prefab
DestroyImmediate(this.gameObject, true);
yield return Resources.UnloadUnusedAssets();
(simple example to load & unload the page & atlases)
But in the profiler it still displaying that both atlases in the memory. Even after using the DestroyImmediate for page1 object
it's atlas is still in the memory.
Iam using NGUI 3.5.5.
Can any body help?
-
Don't use Instantiate. Use NGUITools.AddChild(parent, prefab).
Your NGUI is several months out of date. Please update to the latest. Also before calling UnloadUnusedAssets, call UIDrawCall.ReleaseInactive().