// Use this for initialization void Start() { selectedCube = null; tempCube = null; displayCube = null; mainCamera = Camera.main; // Set team colors numTeams = 2; Color team0Color = Color.red; Color team1Color = Color.blue; // Cubes cubes = GameObject.FindGameObjectsWithTag("Cube"); //SetSurroundingHitboxActive(false); for (int i = 0; i < cubes.Length; i++) { //cubes[i].GetComponent<Rigidbody>().isKinematic = true; // set the team colors ObjectScript oScript = cubes[i].GetComponent <ObjectScript>(); switch (oScript.team) { case 0: oScript.teamColor = team0Color; break; case 1: oScript.teamColor = team1Color; break; } oScript.objectMaterial.color = oScript.teamColor; oScript.SetChildrenColor(); } // Eggs eggs = GameObject.FindGameObjectsWithTag("Egg"); //SetSurroundingHitboxActive(false); for (int i = 0; i < eggs.Length; i++) { eggs[i].GetComponent <Rigidbody>().isKinematic = true; // set the team colors ObjectScript oScript = eggs[i].GetComponent <ObjectScript>(); switch (oScript.team) { case 0: oScript.teamColor = team0Color; break; case 1: oScript.teamColor = team1Color; break; } oScript.objectMaterial.color = oScript.teamColor; } }