21 lines
569 B
C#
Raw Normal View History

2024-12-14 18:27:59 +08:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public static class Extension
{
public static void RemoveAllChildren(this Transform content)
{
for (int i = content.childCount - 1; i >= 0; i--)
{
GameObject.Destroy(content.GetChild(i).gameObject);
}
}
public static void RemoveAllChildrenImmediate(this Transform content)
{
for (int i = content.childCount - 1; i >= 0; i--)
{
GameObject.DestroyImmediate(content.GetChild(i).gameObject);
}
}
}