private void LoadUnits(List <Character.ID> charIDs, Unit.Type type) { foreach (Character.ID id in charIDs) { ICharacter character = PersistentData.Instance.Characters.Get(id); GameObject characterObject = GameObject.Instantiate <GameObject>(Resources.Load <GameObject>(string.Format("{0}{1}", Character.ResourcePath, id)), transform); ICharacterController characterController = characterObject.GetComponent <CharacterController>(); switch (type) { case Unit.Type.PLAYER: playerUnits.Add(characterController); characterObject.transform.position = GetRandomPointInArea(playerSpawnArea); break; case Unit.Type.ENEMY: enemyUnits.Add(characterController); characterObject.transform.position = GetRandomPointInArea(enemySpawnArea); break; } characterController.Load(character, type); } }