forked from BLaZeKiLL/CodeBlazeLibrary
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Merge pull request BLaZeKiLL#27 from dharmeshmp/main
Add transform utility method to destroy all children of transform
- Loading branch information
Showing
3 changed files
with
33 additions
and
0 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
3
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.
Oops, something went wrong.