Skip to content

Commit

Permalink
v1.0.138 FluentAPI:DestroyChildren 改成倒序遍历(misakiMeii 提供反馈和建议)
Browse files Browse the repository at this point in the history
  • Loading branch information
[email protected] committed Jun 21, 2024
1 parent 4ecea72 commit 9e8b043
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"Id": "",
"Version": "v1.0.137",
"Version": "v1.0.138",
"Type": 0,
"AccessRight": 0,
"DownloadUrl": "",
Expand All @@ -11,10 +11,10 @@
],
"DocUrl": "https://liangxiegame.com",
"Readme": {
"version": "v1.0.137",
"content": "FluentAPI:Position2D 支持传 x,y",
"version": "v1.0.138",
"content": "FluentAPI:DestroyChildren 改成倒序遍历 (misakiMeiii 提供反馈和建议)",
"author": "liangxie",
"date": "2024 年 06 月 21 日 21:57",
"date": "2024 年 06 月 21 日 22:03",
"PackageId": ""
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1435,7 +1435,7 @@ public static T DestroyChildren<T>(this T selfComponent) where T : Component
{
var childCount = selfComponent.transform.childCount;

for (var i = 0; i < childCount; i++)
for (var i = childCount - 1; i >= 0; i--)
{
selfComponent.transform.GetChild(i).DestroyGameObjGracefully();
}
Expand All @@ -1457,7 +1457,7 @@ public static T DestroyChildrenWithCondition<T>(this T selfComponent, Func<Trans
{
var childCount = selfComponent.transform.childCount;

for (var i = 0; i < childCount; i++)
for (var i = childCount - 1; i >= 0; i--)
{
var child = selfComponent.transform.GetChild(i);
if (condition(child))
Expand All @@ -1482,7 +1482,7 @@ public static GameObject DestroyChildren(this GameObject selfGameObj)
{
var childCount = selfGameObj.transform.childCount;

for (var i = 0; i < childCount; i++)
for (var i = childCount - 1; i >= 0; i--)
{
selfGameObj.transform.GetChild(i).DestroyGameObjGracefully();
}
Expand Down

0 comments on commit 9e8b043

Please sign in to comment.