The type or namespace name 'ContactFilter2D' could not be found (are you missing a using directive or an assembly reference?) unity

I’m pretty sure that ContactFilter2D is a built in type, so I don’t know why I would be getting this issue. Here’s a code snippet:

 using System.Collections;
 using System.Collections.Generic;
 using UnityEngine;
 using System.Linq;
 using UnityEngine.UI;
    
 public class AIController : MonoBehaviour, IController {
    ...
     private void GetVisibleTargets()
     {
         ...
         ContactFilter2D filter = new ContactFilter2D();
         ...
     }
 }

The line I’m instantiating a ContactFilter2D won’t compile, with the error The type or namespace name 'ContactFilter2D' could not be found (are you missing a using directive or an assembly reference?) unity. I thought it was part of the UnityEngine namespace, so I don’t know why it’s complaining (since I’m using UnityEngine; at the top of the file). Sorry if this is a dumb question. I’m new to Unity and C#. The closest issue I could find to this is this, but I think it’s related to that specific namespace, and not general enough to solve my problem.

Thanks for reading

I worked on this official tutorial and i had this same problem.
This class is nesesery in Rigidbody.cast but in this video must be the old version Unity.
In the last one version Rigidbody.cast have only three arguments.
I don’t used ContactFilter2D and it also work.