NavMeshAgent destination does not set properly unless in Update Method... how can I get it to work outside of the Update Method?

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 after the set statement runs.

However the below code in the update methood 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?

The problem was that I had mistakenly used mouse position vector3, which is screen space and not world space. So I was feeding it screen space and it had no idea where to go.