void Update() { if (_playerUnit.GetComponent <Health>().CurrentHealth <= 0) { if (_playerUnit.playerLives > 0) { PlayerSpaceship player = SpawnPlayer(); _playerUnit.GetComponent <Health>().IncreaseHealth(_playerUnit.GetComponent <Health>().MaximumHealth); } } SetHealthText(); }
void Update() { // Setting the health text in the Update method. SetHealthText(); if (_playerUnit.GetComponent <Health>().CurrentHealth <= 0) { if (_playerUnit.playerLives > 0) { PlayerSpaceship player = SpawnPlayer(); _playerUnit.GetComponent <Health>().IncreaseHealth(_playerUnit.GetComponent <Health>().MaximumHealth); Debug.Log("Totally spawned again, dude!"); } } }