Hi
Does anybody know how to optimize UIRect.OnEnable in NGUI?
when I show the shop window I have a big lag, for example on IPad 3 the window opens for 2 seconds
In Unity profiler i see that method UIRect.OnEnable eat 85% of CPU.
And for now it seems that useing UIRect.OnEnable for disappears it have more CPU then for showing
And for now to hide panels need more CPU work than for instantiate its.
downlod new ngui 3.6.3
run test
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class testbtn : MonoBehaviour {
public GameObject pref;
List<UISprite> gos = new List<UISprite>();
public void OnClick() {
if (gos.Count == 0) {
for (int i = 0; i < 2000; i++) {
GameObject go = NGUITools.AddChild(gameObject, pref);
int ix = Random.Range(-400, 400);
int iy = Random.Range(-400, 400);
go.transform.localPosition = new Vector3(go.transform.localPosition.x + ix, go.transform.localPosition.y + iy, go.transform.localPosition.z);
gos.Add(go.GetComponent<UISprite>());
}
}
else {
foreach (var v in gos) {
v.enabled = !v.enabled;
}
}
}
}
TURNS instantiation FASTER THAN JUST EVEN hide objects, it is planned to do something or not?