??Unity3d Engine Technology Exchange QQ Group: "21568554"
Doing 3d mobile memory has been a headache for people, the load of resources released, there are other needs to release, such as Ngui release. In fact, mainly Ngui texture and sprite release. Assuming that your script does not use the Ngui build reference, the first time after switching the scene calls
Resources.unloadunusedassets ();
Will be released.
But suppose your script is used to build the Ngui. For example, drag directly onto the object on the script. or a Find object. And so on, just to reference Ngui's build, it will be added to the memory, switching scenes will not be released . Resources.unloadunusedassets (); It will not be released, and when you end it, delete the references and you will release them.
I'm citing the idea of iOS to release it. Wrote a Dealloc method.
Write in the interaction class between your scripts
void Dealloc () {
Call the dealloc of other scripts first
Then release the script in the
For example, I add these references to an array.
for (int i = 0; i < Uispritsinscene.count; i++) {destroyimmediate (uispritsinscene[i]); Uispritsinscene[i]=null; } resources.unloadunusedassets (); System.GC.Collect (); }
Can be released. There are great advantages to the mobile side of my memory from the previous 130MB. Optimized to today's 50MB or so, is very stable.
??
Unity3d mobile-side memory optimization (Ngui aspect)