Compare commits

..

No commits in common. "1f70feb68f28f78d2f499fdf581f86f5c62d1274" and "7914a91303b1a86f32465ea7b712c88f9d6c171a" have entirely different histories.

View File

@ -423,34 +423,4 @@ public class Utility
list[j] = temp;
}
}
// 该方法用于打乱当前脚本所挂载物体的子物体顺序
public void ShuffleChildObjects(Transform parent)
{
List<Transform> children = new List<Transform>();
for (int i = 0; i < parent.childCount; i++)
{
children.Add(parent.GetChild(i));
}
// 打乱子物体数组的顺序
for (int i = 0; i < children.Count; i++)
{
int randomIndex = UnityEngine.Random.Range(i, children.Count);
Transform temp = children[randomIndex];
children[randomIndex] = children[i];
children[i] = temp;
}
// 按照打乱后的顺序重新设置子物体的顺序
for (int i = 0; i < children.Count; i++)
{
children[i].SetSiblingIndex(i);
}
}
}