NavMeshAgent destination ignores what it is set to and resets itself outside of Update()

I have a navmesh baked. I have a UnitMeshController object that has a reference to a NavMeshAgent.

On that object there is a Vector3 Destination that is public and can be set outside by my game controller. When I click a point on the terrain, the game controller tells the UnitMeshController to move by setting its Destination to the Vector3 of the mouse position.

Logs show that the property is changed correctly, and then when the _agent.destination = Destination property fires, the log shows that the _agent.destination value never changes.

The end result is the mesh stands there and does nothing.

If I put a bit of trash code in the Update() method stating if the right mouse button is clicked, to move the agent to that location by saying _agent.destination = hit.point, it works just fine.

So it appears that you can not set the destination of a navMeshAgent outside of an Update method??

The below is the property. _agent is a NavMeshAgent instantiated on Start().

 public Vector3 Destination
        {
            get { return _destination; }
            set
            {
                if (_destination != value)
                {
                    Debug.Log($"Destination was changed to {value}");
                    _destination = value;
                    _agent.destination = _destination;
                    Debug.Log($"_agent.Destination was changed to {_agent.destination}");
                }
            }
        }

In the game controller I just state mesh.Destination = . Again - this sets the property correctly but does nothing. The agent.destination value does not change and remains the same.

However this code works just fine in the same object. This is not how I want to implement this code however. I do not want the update method controlling anything in this meshcontroller. I wanted to just be able to set the _agent.destination and have it do its thing.

        void Update()
        {
          
            if (Input.GetMouseButtonDown(1))
            {
                RaycastHit hit;
                if (Physics.Raycast(Camera.main.ScreenPointToRay(Input.mousePosition), out hit, 100))
                {
                    _agent.destination = hit.point;
                }
            }          
        }

Anyone know what I am missing here?

Solved after many hours of comparing data. hit.point works because thats a world position vector3. I was passing in a mouseposition vector3, which is screen space, not world space. It wasn’t moving because the coordinates it was getting were not legit.