Decrementing UI Text for Items remaining

I have a scene with a simple player walking around picking up items. I can achieve this, but when he hits an item I want my Text UI to decrement each time. I have looked this up in other articles and tried their methods, but none have worked for me. Can you tell me why the code below is not decrementing with each pick up?

public int remaining = 3;
public Text enemyText;

void Update()
    {
      
        enemyText.text = (remaining).ToString("0");

    }

void OnTriggerEnter(Collider other)
    {
        if (other.gameObject.CompareTag("Pick Up"))
        {
            other.gameObject.SetActive(false);
            remaining--;
            //--remaining;
            //remaining = -1;
            enemyText.text = remaining.ToString();
        }
    }

I would really appreciate if someone could explain to me what I am doing wrong. I have tried examples found elsewhere on Unity Answers and none (such as above) seem to be work.

I don’t think you need to update your text every frame. And also OnTriggerEnter already update your text when hit something. Try to remove update function.

I’m using the free Unity Starter kit and using their 3rd person to walk around a plane to collide with spheres and hopefully invoke the enemy remaining script. For some reason, it is not working at all. I am also using URP (glowing spheres), but I am still new to Unity so not sure if that changes anything more than effects. I did try your script and nothing happened. I checked the console and had 505 errors, all to do with the Starter Kit, not the remaining enemy script. The errors vary, but it was mostly things like:

NullReferenceException: Object reference not set to an instance of an object
EnemyAI.EnemyMove () (at Assets/StarterKit-MoveCamAI/StarterKit/Scripts/Enemy/EnemyAI.cs:81)
EnemyAI.FixedUpdate () (at Assets/StarterKit-MoveCamAI/StarterKit/Scripts/Enemy/EnemyAI.cs:42)

Is this a URP error or am I doing something wrong?