public bool ApplyPowerUp(GameObject obj) { // Attempt to get a PlayerHealthBehaviour from obj PlayerHealthBehaviour health = obj.GetComponentInParent <PlayerHealthBehaviour>(); // If we were successful, regen health and return true if (health) { health.RegenHealth(_amountToHeal); return(true); } else { return(false); } }