private void Start() { healthText = GetComponent <TMP_Text>(); PlayerController playerController = FindObjectOfType <PlayerController>(); Damagable damagable = playerController.gameObject.GetComponent <Damagable>(); damagable.registerOnDamaged((shipInfo) => updateHealth(shipInfo)); updateHealth(damagable.getShipInfo()); }