private void RandomizeRoles() { //shuffles the roles around into a new list List <EnumPlayerRole> shuffedRoles = new List <EnumPlayerRole>(); int randomIndex; while (mValidUserRoles.Count > 0) { randomIndex = Random.Range(0, mValidUserRoles.Count); shuffedRoles.Add(mValidUserRoles[randomIndex]); mValidUserRoles.RemoveAt(randomIndex); } //gives a new players list their roles List <Player> players = new List <Player>(); int i; for (i = 0; i < mPlayerCount; ++i) { players.Add(new Player(mUsernames[i], shuffedRoles[i])); Debug.Log(players[i].ToString()); } //set list of valid roles mTurnManager.setPlayers(players); }