Recently I think about NGUI's geometry rebuild mechanism...
I worry about if it is really efficient than dynamic batching in case many widgets are in motion tweening..
I also found thread like
http://www.tasharen.com/forum/index.php?topic=845.0http://www.tasharen.com/?topic=ngui-optimization-problemIn case that a UIPanel have many widgets, and most of widgets are moving with TweenPosition,
UIPanel has to rebuild geometry at every frame. I think that it may drop performance.
I have tested with simple code below.
using UnityEngine;
using System.Collections;
public class demo : MonoBehaviour
{
public GameObject cube;
public GameObject btn1;
public UIPanel panel;
void Start()
{
for (int i = 0; i < 100; i++)
{
GameObject go = NGUITools.AddChild(panel.gameObject, btn1);
go
.transform.localPosition = new Vector3
(-400,
-240 + i
* 4); TweenPosition
.Begin(go,
10,
new Vector3
(400,
-240 + i
* 4)); }
}
}
It just generate 100 buttons, and tween position from left side to right side of screen for 10 sec.
In Unity Editor of fastest quality setting, it show 150fps for tweening. After tweening, it shows 500-600fps. (About 70% performance drop)
Same test with a cube instead of NGUI widget, it show 450-500fps even with 3 more draw calls. After tweening, it shows 900-1000fps. (About 50% performance drop)
I also check time of LateUpdate() in UIPanel with Diagnotics.Stopwatch in first case(not a same time).
It shows 3-7 ms in Editor, 20-30 ms in Device(Galaxy S)-> hard to get 60fps.
Is NGUI really faster than unity's default dynamic batching (in case that about 100 widgets with a same material are motion tweening)?