I call getComponentsInChildren after destroying some children and i obtain a wrong list of elements…
This is the metacode:
// my list of components
public List<Tile> tiles;
void Awake ()
{
// here i destroy some childs
RaycastHit hit;
if (Physics.Raycast (new Vector3 (1, 1, 1), Vector3.down * 2f, out hit))
Destroy (hit.transform.gameObject);
// and here the getComponentsInChildren fails. I obtain a List with a Missing component in place of the destroyed child...
foreach (Tile t in transform.GetComponentsInChildren<Tile>())
tiles.Add (t);
}
Any hints?