I has create gameobject and add script to camera but not show if in project I add UI of NGUI
void Start()
{
for (int i = 0; i < maxLevel; i++)
{
var obj = new GameObject("Block" + i);
obj.AddComponent("GUITexture");
obj.AddComponent("BlockDrag");
obj.AddComponent("AudioSource");
obj.transform.localScale = Vector3.one;
listBlock.Add(obj);
}
}
void OnGUI(){
foreach (var x in listBlock)
{
x.BlockObject.guiTexture.pixelInset = x.BlockRect;
x.BlockObject.guiTexture.texture = GetBlockColorById(x.BlockColorId).Texture2D;
}
}
see my picture:

can anyone see where I am going wrong?