Skip to content

Commit 3160224

Browse files
committed
feat(Util): Add destroy all children
1 parent a347e64 commit 3160224

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

Assets/JCSUnity/Scripts/Util/JCS_Util.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -687,6 +687,17 @@ public static GameObject SpawnAnimateObjectDeathEvent(RuntimeAnimatorController
687687

688688
#region Destroy
689689

690+
/// <summary>
691+
/// Destroy all children under the transform.
692+
/// </summary>
693+
public static void DestroyChildren(Transform transform)
694+
{
695+
foreach (Transform child in transform)
696+
{
697+
MonoBehaviour.Destroy(child.gameObject);
698+
}
699+
}
700+
690701
/// <summary>
691702
/// Destroy all the 'TYPE' object in the scene.
692703
/// </summary>

0 commit comments

Comments
 (0)