public void DestroyAllData() { if (_parameters != null) { _parameters.CleanUp(); _parameters = null; } if (_isGeoCurve && _targetGameObject != null) { HEU_HAPIUtility.DestroyGameObject(_targetGameObject); _targetGameObject = null; } }
/// <summary> /// Destroy child GameObjects under the given gameObject with component T. /// </summary> /// <typeparam name="T">The component to look for on the child GameObjects</typeparam> /// <param name="gameObject">The GameObject's children to search through</param> public static void DestroyChildrenWithComponent <T>(GameObject gameObject) where T : Component { Transform trans = gameObject.transform; List <GameObject> children = new List <GameObject>(); foreach (Transform t in trans) { children.Add(t.gameObject); } foreach (GameObject c in children) { if (c.GetComponent <T>() != null) { HEU_HAPIUtility.DestroyGameObject(c); } } }