I’m sure I’m missing something pretty obvious, but I was following the get started guide, have the basic grid map setup, made a capsule, attached a character controller, a seeker, and the script to it. When I try to run I get “NullReferenceException: Object reference not set to an instance of an object
AI_Movement.Start () (at Assets/Scripts/AI_Movement.cs:15)”
on the line calling the seeker. Stepping through, as it goes, everything has a definition, but it breaks halfway through that line.
Here’s the code:
using UnityEngine;
using System.Collections;
using Pathfinding;
public class AI_Movement : MonoBehaviour {
public Vector3 targetPosition;
public void Start () {
Seeker seeker = GetComponent<Seeker>();
//Start a new path to the targetPosition, return the result to the OnPathComplete function
(line 15)seeker.StartPath (transform.position,targetPosition, OnPathComplete);
}
public void OnPathComplete (Path p) {
Debug.Log ("Yey, we got a path back. Did it have an error? "+p.error);
}
}