NGUI当中sprite等控件是没有Mesh Render的
也就是说在Hierarchy面板中看到的NGUI控件是不会渲染的 他们只是用来存储Tranform信息以及脚本的载体
UIPanel
NGUI真正渲染的东西叫做UIDrawCall NGUI的UIDrawCall是以UIPanel为载体的
public class UIPanel : MonoBehaviour{
OrderedDictionary mChildren = new OrderedDictionary();
// List of all widgets managed by this panel
BetterList<UIWidget> mWidgets = new BetterList<UIWidget>();
// Widgets using these materials will be rebuilt next frame
BetterList<Material> mChanged = new BetterList<Material>();
// List of UI Screens created on hidden and invisible game objects
BetterList<UIDrawCall> mDrawCalls = new BetterList<UIDrawCall>();
// Cached in order to reduce memory allocations
BetterList<Vector3> mVerts = new BetterList<Vector3>();
BetterList<Vector3> mNorms = new BetterList<Vector3>();
BetterList<Vector4> mTans = new BetterList<Vector4>();
BetterList<Vector2> mUvs = new BetterList<Vector2>();
}
NGUI中所有的可渲染控件都继承自
UIWidget
在UIWidget的Start()中
调用的CreatePanel()会把自己与父节点的Panel关联起来
并把自己Add到父Panel的mWidgets中去
之后比较重要的一个方法是UIPanel的void Fill (Material mat)
这个方法他会遍历Panel上的mWidgets然后
GetDrawCall