Hi there.
I am currently facing a problem with NGUITools.DestroyImmediate(). I have a UITable being filled with prefabs (label & sprite combination) using NGUITools.AddChild(obj, prefab). When trying to destroy the objects and repopulate the table using a for loop, a weird thing happen. The first time it works fine, the second time one item is left behind and end up with a list n+1 (n=list count), and the third time two objects resist destruction and the table becomes n+2! Thereafter, it persists with 2 superfluous items no matter how many more times I run the code.
The code is as simple as this:
foreach (Transform calib in m_calibrationTable.transform)
{
NGUITools.DestroyImmediate(calib.gameObject);
}
I also tried NGUITools.Destroy() but doesn't destroy the objects at all. Any ideas why this is happening?