public void SwitchUnit() { if (U != null) { U.Owner = NewFaction; U.Alliance = U.GM.ThisGame[NewFaction].Alliance; U.SetColor(); if (thisDialog != null) { thisDialog.ResetDialog(); thisDialog.NextLine(); } foreach (GameObject AI in U.GM.AIPlayers) { if (U.Alliance != AI.GetComponent <Tracker>().Team) { AI.GetComponent <Tracker>().Enemies.Add(U.gameObject); } } U.TurnStart(); U = null; } else { return; } }