# How do you set the target location for a navmesh using a GameObject?

I am trying to get a GameObject to navigate through a map and get to the exit. I have created a navmesh for the map and given the player GameObject a navmesh agent. The exit is marked with a empty GameObject. Using the unity manual I made this script and atached it to the player:

function Start ()
{
var agent: NavMeshAgent = GetComponent.<NavMeshAgent>();
agent.SetDestination(GameObject.Find("exit"));
}


The porblem is that this script gives the error

"Assets/Scripts/enemy.js(4,29): BCE0017: The best overload for the method 'UnityEngine.NavMeshAgent.SetDestination(UnityEngine.Vector3)' is not compatible with the argument list '(UnityEngine.GameObject)'."

I think is is because unity wants a vector3 but I have given it a GameObject. How can I get this to work with a game object?

To fix this, you could pass in transform.position:
function Start ()