I am having a similar problem, I am creating a bunch of buttons at runtime in a grid, but the buttons are not being destroyed afterwards.
Here is how I add the buttons:
GameObject grid = GameObject.Find("Logic Grid");
int length = PlayEditorStrings.szStandard.Length - 1;
for (int i = 0; i < length; ++i)
{
GameObject player = NGUITools.AddChild(grid, Resources.Load("Logic Button") as GameObject);
player.name = PlayEditorStrings.szStandard[i];
player.GetComponentInChildren<UILabel>().text = PlayEditorStrings.szStandard[i];
}
And here is what I am calling on OnApplicationQuit()
GameObject grid = GameObject.Find("Logic Grid");
if (grid != null)
{
Transform trans = grid.transform;
while (trans.childCount > 0)
{
NGUITools.Destroy(trans.GetChild(0).gameObject);
}
}
However, none of the objects are ever being destroyed, and will pile up if I run it multiple times.
I was doing something similar with UILabel prefabs, and it works fine, but using a simple button made as a prefab doesn't work.