cant enable game object systemin runtime

i wrote this code so that it enable a game object when it collides with water but it dosent seems to work

using UnityEngine;

public class particleEnabler : MonoBehaviour
{
    public GameObject a;
    
    void OnCollisionEnter(Collision h)
    {
        if (h.collider.tag == "water")
        {
            a.SetActive(true);
          

        }
      
    }

    void OnCollisionExit(Collision h)
    {
        if (h.collider.tag == "water")
        {
            a.SetActive(false);
        }
      
    }
}

pls help

Your code is only half (or less) of the information we need to solve this issue. How is your scene set up? Which object is this script attached to? Which object is “a”? Is the object this is attached to disabled at the start of the scene? This script won’t run if the object is disabled.

As for debugging, the first step would be to add some Debug.Log statements in your code. I would put one between line 8 and 9, and one between line 19 and 20. This way you can check whether your code is even running.

nvm i fixed it