I have created a UIPanel with a UIGrid inside of it in the editor, and fill it with a prefab dynamically. the clipping area is set on the UIPanel of course, and the gizmo shows it in the right spot.
The prefab object is just a game object which contains a UIbutton, a UIlabel, a UISlider.
If i put a bunch of these prefabs into the UIGrid in the editor, the clipping works perfectly. If i add them dynamically, the clipping does not work at all, although the gizmo still shows as the correct size and placement.
I am new to NGUI and have the purchased version. Using unity 3.5.2f2 with NGUI 2.0.7c on OS Lion.
Any help would be appreciated! Is there anything you have to do? I have tried re-specifying the clipping data, which did not help. Below is a simplified version, since my version actually has UIGrids with UIGrids in them (so i can have a 3 columns by X rows grid)
// up in Start()
Game Object _panelParent = GameObject.Find("MyPanel");
UIPanel _panel = _panelParent.GetComponent<UIPanel>();
UIDraggablePanel _panelDragger = _panelParent.GetComponent<UIDraggablePanel>();
//this is repeated for many prefabs.
GameObject prefab = (GameObject)Instantiate (Resources.Load ("Prefabs/UI/MyPrefab"));
prefab.transform.parent = _uigridGO.transform;
prefab.layer = _panelParent.layer;
prefab.GetComponent<UIDragPanelContents> ().draggablePanel = _panelDragger;
prefab.transform.localScale = Vector3.one;
prefab.transform.localPosition = Vector3.zero;
prefab.transform.localRotation = Quaternion.identity;
_uigrid.repositionNow = true;
_panelDragger.repositionClipping = true;