common extensions and some utilities
This commit is contained in:
19
Runtime/Engine/Code/Extensions/TransformEx.cs
Normal file
19
Runtime/Engine/Code/Extensions/TransformEx.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using Object = UnityEngine.Object;
|
||||
|
||||
namespace RebootKit.Engine.Extensions {
|
||||
public static class TransformEx {
|
||||
public static void DestroyChildren(this Transform transform) {
|
||||
foreach (Transform child in transform) {
|
||||
Object.Destroy(child);
|
||||
}
|
||||
}
|
||||
|
||||
public static void ForEachChild(this Transform transform, Action<Transform> action) {
|
||||
foreach (Transform child in transform) {
|
||||
action(child);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user