Hey i have tried to make a Object with an seeker attached to it but keeps giving me this error.
NullReferenceException: Object reference not set to an instance of an object
internal var seeker: Seeker = GetComponent(Seeker);
//Find closest object with certain tag
seeker.StartPath(gameObject.transform.position, closest.transform.position);
Can someone please give me some afvice on how to fix this?
A.
There isn’t a Seeker Component attached to the gameObject this script is attached to so
seeker isn’t equal to anything
B
closest which i can see is in here but not what it is may not be equal to anything
Fix A by adding a Seeker Component you could even use a RequireComponent Seeker in the gameObject code so it throws an error if a seeker isnt attached.