Skip to content

Commit

Permalink
prevent modification while iteration
Browse files Browse the repository at this point in the history
  • Loading branch information
kaikoga committed Mar 3, 2024
1 parent 10058da commit f724bbe
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Runtime/RuntimeUtil.cs
Original file line number Diff line number Diff line change
Expand Up @@ -186,13 +186,15 @@ public static Transform FindAvatarInParents(Transform target)
/// <returns></returns>
internal static IEnumerable<Transform> FindAvatarsInScene(Scene scene)
{
var list = new List<Transform>();
foreach (var root in scene.GetRootGameObjects())
{
foreach (var avatar in root.GetComponentsInChildren<Animator>())
{
if (IsAvatarRoot(avatar.transform)) yield return avatar.transform;
if (IsAvatarRoot(avatar.transform)) list.Add(avatar.transform);
}
}
return list;
}
}
}

0 comments on commit f724bbe

Please sign in to comment.