private void Awake() { Game = this; //Check if enemy is human if (PlayerPrefs.GetInt("IsHuman", 1) == 1) { Enemy.gameObject.SetActive(false); HumanEnemy.FromString(PlayerPrefs.GetString("EnemyStats")); Enemy = HumanEnemy; IsHuman = true; PlayerPrefs.SetInt("Music", 3 + PlayerPrefs.GetInt("IsBoss", 0)); } else { HumanEnemy.gameObject.SetActive(false); PlayerPrefs.SetInt("Music", 1 + PlayerPrefs.GetInt("IsBoss", 0)); } if (PlayerPrefs.GetInt("IsBoss", 0) == 1) { Color target = Enemy.Body.GetComponent <Renderer>().materials[0].color; foreach (var item in Enemy.Body.GetComponentsInChildren <Renderer>(true)) { if (item.materials[0].color == target) { item.materials[0].color = BossColor; } } } //Load enemy and player from prefs Enemy.FromString(PlayerPrefs.GetString("EnemyStats")); if (!PlayerPrefs.HasKey("PlayerStats")) { //Init stats Player.Name = "M43 (you)"; Player.MaxHealth = 10; Player.MaxEnergy = 10; Player.Power = 2; Player.Defense = 2; PlayerPrefs.SetString("PlayerStats", Player.ToString()); } Player.FromString(PlayerPrefs.GetString("PlayerStats")); }