Function OnDrop() of EventSystems doesn't trigger

I am trying to make the UI of my game’s inventory system. I currently am trying to trigger the OnDrop() function when the player’s cursor is over a panel. (The panel is invisible but takes almost the whole screen and serves as the area where the player can drop an item). Here is the code:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;

public class ItemDropHandler : MonoBehaviour, IDropHandler
{

    RectTransform invDropArea;
    public bool isOverDroppableArea;

    void Start()
    {       
       
        invDropArea = GameObject.Find("DropArea").GetComponent<RectTransform>();

    }

    public void OnDrop(PointerEventData eventData)
    {

        if(isOverDroppableArea == true)
        {

            Debug.Log("Drop");

        }

    }

    void Update()
    {

        isOverDroppableArea = RectTransformUtility.RectangleContainsScreenPoint(invDropArea, Input.mousePosition);
        Debug.Log(isOverDroppableArea);

    }

}

I don’t see where you set the “isOverDroppableArea” bool true. You should use

            Debug.Log("invDropArea = " + invDropArea)

in Start() to make sure that the object is found.

Instead of

            Debug.Log("Drop");

use

            Debug.Log(isOverDroppableArea);

to make sure that it’s true.

“isOverDroppableArea” becomes true using RectTransformUtility.RectangleContainsScreenPoint.
As soon as the cursor hovers over the area it stays true until it’s out of the area.

Even out of the if() statement no Debug.Log appears with OnDrop()

Here’s a quick video on what happens with the boolean:

Maybe but did you use the Debug.Log() I mentioned to make sure of that?

Yes I did.
Debug.Log("invDropArea = " + invDropArea) returns the correct gameObject which has the RectTransform.
However, even modifying the Debug.Log(“Drop”) in the OnDrop() function to Debug.Log(isOverDroppableArea); doesn’t change much as the whole OnDrop() function never triggers.

Are yu sure nothing prevents the event to trigger on your UI elements?

Ah I found out why. I disabled completely the Image component from the panel, which needs to be enabled for the drop to work. Solved. Thanks for your help