Skip to content

Commit

Permalink
fix: Round Robin Spawning by Hierarchy Order (#790)
Browse files Browse the repository at this point in the history
Fixes #724
  • Loading branch information
MrGadget authored and miwarnec committed Apr 10, 2019
1 parent f46f32d commit 531e202
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Assets/Mirror/Runtime/NetworkManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -508,6 +508,12 @@ public static void RegisterStartPosition(Transform start)
{
if (LogFilter.Debug) Debug.Log("RegisterStartPosition: (" + start.gameObject.name + ") " + start.position);
startPositions.Add(start);

// reorder the list so that round-robin spawning uses the start positions
// in hierarchy order. This assumes all objects with NetworkStartPosition
// component are siblings, either in the scene root or together as children
// under a single parent in the scene.
startPositions = startPositions.OrderBy(transform => transform.GetSiblingIndex()).ToList();
}

public static void UnRegisterStartPosition(Transform start)
Expand Down

0 comments on commit 531e202

Please sign in to comment.