I am coding a script in which an enemy who when it finds a set of footprints will start following the footprints to find the player. It works fairly well with a few issues in the movement related only to what I can assume is the navmesh but I get this error.
ArgumentException: GetComponent requires that the requested component ‘Vector3’ derives from MonoBehaviour or Component or is an interface.
It doesn’t stop the enemy from following the footsteps and everything is still mostly functional but I still want to get rid of this bug.
Here is my code. It’s not very clean or organized or probably optimal as it is just me working on it.
void OnTriggerStay(Collider col)
{
//If the wolf stumbles upon any footstep trackers this gets their specific instance and sequence number.
if (col.gameObject.CompareTag("tracking")) {
footstepTracking thisFoot = col.GetComponent<footstepTracking>();
if (PlayerInSight == false) {
this.gameObject.GetComponent <NavMeshAgent> ().destination = nextFootLoc;
}
foreach (GameObject footprint in footTrack){
footstepTracking thatFoot = footprint.GetComponent<footstepTracking>();
Debug.Log (thatFoot.Seq);
if (thatFoot.Seq == (thisFoot.Seq + 1)) {
nextFootLoc = thatFoot.GetComponent<Vector3> ();
Debug.Log ("The next footprint is" + thatFoot.Seq);
}