ColliderDistance2D.distance not working, keeps telling me it can not be used as a method. But the docs say it can be used to find the distance

ColliderDistance2D.distance is supposed to get the distance between 2 colliders. however when I attempt to use it as the example shows:

ColliderDistance2D.distance {get; set;}

I get told not to use it as a method. Or that I need an object reference for the non-static field. I have attempted a couple different configurations but I only get errors. Here are my two best throws at it and the error produced;

public class enemy : MonoBehaviour
{
    [SerializeField] BoxCollider2D visionCone;
    Rigidbody2D myRigidBody;
    public bool iSeePlayer = false;
    Vector2 distanceToMove;
    // Start is called before the first frame update
    void Start()
    {
        myRigidBody = GetComponent<Rigidbody2D>();
    }

    // Update is called once per frame
    void Update()
    {
       
    }

    public void OnTriggerStay2D(Collider otherBody)
    {
        iSeePlayer = true;
        Vector2 distanceToMove = ColliderDistance2D.distance (myRigidBody,otherBody); 
         Vector2 toPlayerPos = new Vector2();
    } 
}

non-invocable member, colliderdistance2d.distance can not be invoked as a method

public class enemy : MonoBehaviour
{
    [SerializeField] BoxCollider2D visionCone;
    Rigidbody2D myRigidBody;
    public bool iSeePlayer = false;
    Vector2 distanceToMove;
    // Start is called before the first frame update
    void Start()
    {
        myRigidBody = GetComponent<Rigidbody2D>();
    }

        // Update is called once per frame
        void Update()
        {
           
        }
    
        public void OnTriggerStay2D(Collider otherBody)
        {
            iSeePlayer = true;
            Vector2 distanceToMove = ColliderDistance2D.distance { myRigidBody; otherBody; }; 
             Vector2 toPlayerPos = new Vector2();
        } 
    }

an object reference is required for non static field

I understand that it is telling me to not use it as a method. But then it asks me for an object reference. I give it an object reference only to be told that it can't be used like a method.

grrrrrrr :(

How many English words
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
Powered by Examplum