private void Start() { healthController = GetComponentInParent <HealthController>(); maxHealth = healthController.Health; previusHealth = healthController.Health; healthChangedEvent.RegisterListener(UpdateHealthBar); }
// When the object is enabled, you must immediately add it to the channel private void OnEnable() { _event.RegisterListener(this); }