Filling up my Powerbar when an enemy has been killed

Hi, im writing a 2D Game and I have a power bar which shall be filled when an enemy is killed. The problem it isnt working. Oh and my Death Animation of the enemyisn’t working too. Here’s my code:

public class Enemy : MonoBehaviour
{
    public float health = 1;
    public bool isDead = false;
    public float damage = 1;
    Animator anim;
    MummyWalk walk;

    void ApplyDamage(float damage)
    {
        health -= damage;

        if (health <= 0)
        {
            Debug.Log("ApplyDamage geht");
            isDead = true;
            KillCounter.killCounter.killcount = KillCounter.killCounter.killcount + 1;
          
           Death();
        }
    }
  
    void Death()
    {
        Debug.Log("Death Funktion geht");
        isDead = true;
       anim.SetTrigger("mummy_death");
       walk.enabled = false;
    }

public class HealthController : MonoBehaviour
{
    private float power = 0;
    public float startPower = 0;
  
 
    private float maxPower = 100;
    public Image powerGUI;
    Enemy enemy;

    void Start ()
    {
     
      
        if(Application.loadedLevel == 0)  
        {
            power = startPower;
         
        }
        else
        {
            power = PlayerPrefs.GetFloat("power");
         
        }
      
        UpdateView();
    }

void UpdateView()
{
if(enemy.isDead == true && powerGUI.fillAmount != maxPower )
        {
            powerGUI.fillAmount = maxPower / power;
        }
}

Any logs in Unity console? Can I have a screenshot of your workspace environment?

Sorry, but what exactly do you need with workspace environment?

I just want to see what your unity screen looks like, For example this is what mine looks like:

I’m not sure this code would compile - Is it missing an end brace on the HealthController class? Also, it is generally best practice to only place one class in a C# script file. If you want multiple behaviors, use multiple files.

That said, where do you assign the reference to anim? It is Private, yet I don’t see where you assign it to the Animator component. Also, it appears that in your HealthController class, UpdateView is only called once at Start, not when I would expect at ApplyDamage.