Skip to content

Commit

Permalink
feat: Merge pull request BLaZeKiLL#27 from dharmeshmp/main
Browse files Browse the repository at this point in the history
Add transform utility method to destroy all children of transform
  • Loading branch information
BLaZeKiLL authored Nov 28, 2020
2 parents dd5e89b + 82f1e46 commit e9efe5a
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Assets/Src/Library/Runtime/Extensions/Transform.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 22 additions & 0 deletions Assets/Src/Library/Runtime/Extensions/Transform/Utils.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using UnityEngine;

namespace CodeBlaze.Library.Extensions
{
public static class Utils
{
/// <summary>
/// Destroy all children of transform
/// </summary>
/// <param name="transform"></param>
/// <returns></returns>
public static Transform Clear(this Transform transform)
{
foreach (Transform child in transform)
{
Object.Destroy(child.gameObject);
}

return transform;
}
}
}
3 changes: 3 additions & 0 deletions Assets/Src/Library/Runtime/Extensions/Transform/Utils.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit e9efe5a

Please sign in to comment.