using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.AI;
public class Navigator : MonoBehaviour {
public Transform target;
NavMeshAgent agent;
void Start ()
{
agent = GetComponent<NavMeshAgent> ();
}
void Update ()
{
agent.SetDestination (target);
}
}
So, I tried to create a simple navigation for my agent object to reach the goal. However, my code returned two errors in which I am unable to comprehend.
Assets/Scripts/Navigator.cs(19,25): error CS1503: Argument #1' cannot convert UnityEngine.Transform’ expression to type `UnityEngine.Vector3’
Assets/Scripts/Navigator.cs(19,9): error CS1502: The best overloaded method match for `UnityEngine.AI.NavMeshAgent.SetDestination(UnityEngine.Vector3)’ has some invalid arguments
Can someone advise me on the best course of action? Thank you.