private void Start() { playerHealth = playerHealthObject.GetComponent <IHealth>(); playerHealth.AddHealthBar(this); if (playerHealth == null) { Debug.LogWarning("Healthbar not connected to health"); } HealthBarImage = GetComponent <Image>(); }
private void Start() { mainCamera = Camera.main; myHealth = GetComponent <NPCHealth>(); myHealth.AddHealthBar(this); slider = GetComponentInChildren <Slider>(); if (slider == null) { Debug.Log($"Slider not found for Healthbar on {gameObject}"); } slider.gameObject.SetActive(false); }