Exemplo n.º 1
0
    static void AddReuseGrid()
    {
        UIReuseGrid grid = NGUITools.AddChild <UIReuseGrid>(NGUIEditorTools.SelectedRoot());

        UIReuseScrollView scrollView = grid.transform.parent.GetComponent <UIReuseScrollView>();

        if (scrollView != null)
        {
            grid.m_ReuseScrollView = scrollView;
        }

        UIPanel panel = grid.transform.parent.GetComponent <UIPanel>();

        if (panel != null)
        {
            grid.transform.localPosition = new Vector3(panel.finalClipRegion.z * -0.5f + panel.finalClipRegion.x, panel.finalClipRegion.w * 0.5f + panel.finalClipRegion.y, 0.0f);
        }

        Selection.activeGameObject = grid.gameObject;
    }
Exemplo n.º 2
0
 void Awake()
 {
     grid = GetComponentInChildren <UIReuseGrid>();
 }