From 34216549cecce7b1e2a4fdf233d1408b957db82d Mon Sep 17 00:00:00 2001 From: KyroVibe Date: Fri, 10 Jan 2020 22:43:17 -0800 Subject: [PATCH] Fixed bug that added bots and messed up controls --- engine/Assets/Scripts/States/MainState.cs | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/engine/Assets/Scripts/States/MainState.cs b/engine/Assets/Scripts/States/MainState.cs index 3edc229e11..8245c8cce8 100644 --- a/engine/Assets/Scripts/States/MainState.cs +++ b/engine/Assets/Scripts/States/MainState.cs @@ -530,16 +530,17 @@ public bool ChangeRobot(string directory, bool isMixAndMatch) UnityEngine.Object.Destroy(SpawnedRobots[index].gameObject); ActiveRobot = null; - int i = 0; - foreach (SimulatorRobot robot in SpawnedRobots) - { - robot.ControlIndex = i; - i++; - } - - if (LoadRobot(directory, isMixAndMatch)) + if (LoadRobot(directory, isMixAndMatch, index)) { DynamicCamera.ControlEnabled = true; + + int i = 0; + foreach (SimulatorRobot robot in SpawnedRobots) + { + robot.ControlIndex = i; + i++; + } + return true; }