/// <summary> /// Destroys all the children of a transform. /// </summary> /// <param name="transform">The transform containing the children to destroy.</param> public static void DestroyAllChildren(this Transform transform) { if (!transform) { return; } for (int i = transform.childCount - 1; i >= 0; i--) { Transform t = transform.GetChild(i); if (!t) { continue; } UnityUtils.DestroyObject(t); } }
// Start is called before the first frame update private void Start() { UnityUtils.DestroyObject(this, m_Time); }
private void Awake() { UnityUtils.DestroyObject(this); }