This commit is contained in:
CortexCore
2025-08-03 02:28:50 +08:00
parent ecae0f809c
commit c3f0a8e840
8 changed files with 114 additions and 6 deletions

View File

@@ -17,5 +17,18 @@ namespace BITKit
Object.Destroy(t);
return t;
}
public static int RemoveComponentsInChildren<T>(this GameObject gameObject) where T :Component
{
var count = 0;
foreach (var x in gameObject.GetComponentsInChildren<T>())
{
if (!x) continue;
Object.Destroy(x);
count++;
}
return count;
}
}
}