Skip to content

Instantly share code, notes, and snippets.

@HassakuTb
Created August 19, 2018 10:04
Show Gist options
  • Save HassakuTb/ced1125d6a8bd0da9131864347a133b8 to your computer and use it in GitHub Desktop.
Save HassakuTb/ced1125d6a8bd0da9131864347a133b8 to your computer and use it in GitHub Desktop.
Destroy all children of GameObject
using UnityEngine;
public static partial class TransformExtentions {
public static void DestroyAllChildren(this Transform tf) {
foreach(Transform t in tf) {
GameObject.Destroy(t.gameObject);
}
tf.DetachChildren();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment