Check this method for correctness

Hi, I crafted this method for checking if a point is reachable:

public static bool CanReach(Vector3 from,Vector3 to)
        {
            var fromNode = AstarPath.active.GetNearest(from).node;
            
            var toNode = AstarPath.active.GetNearest(to).node;

            if (fromNode.Area == toNode.Area)
            {
                return true;
            }
            if (PathUtilities.IsPathPossible(fromNode,
                    toNode))
            {
                return true;
            }
            //check adjacent positions
            for (int i = -1; i <=1; i++)
            {
                for (int j = -1; j <= 1; j++)
                {
                    Vector3 adjacent = new Vector3(to.x + i, to.y + j);
                    
                     var   adjacentNode = AstarPath.active.GetNearest(adjacent).node;

                    if (adjacentNode.Area == fromNode.Area)
                    {
                        return true;
                    }
                    if (PathUtilities.IsPathPossible(fromNode,
                            adjacentNode))
                    {
                        return true;
                    }
                }
            }
            return false;
        }

I wanted to ask if it’s a correct way to check

Yeah this looks fine to me; it looks like you have special reason to be checking to make sure the area is the same, and anything I was gonna suggest is already in here. :+1: