Created
November 8, 2024 15:37
-
-
Save andydbc/f4e704e2cc51e286ea39d5f88e721d28 to your computer and use it in GitHub Desktop.
Helper extensions for Transform: delete all child objects of a Transform
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
public static class TransformExtensions | |
{ | |
public static void DestroyChildren(this Transform t) | |
{ | |
foreach (Transform child in t) | |
{ | |
GameObject.Destroy(child.gameObject); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment