public void Dead() { gameObject.SetActive(false); foreach (Transform child in childCubes) { CubeManager mgr = child.GetComponent <CubeManager>(); Instantiate(explosion, mgr.GetCenterPosition(), Random.rotation); } }