Nullreference on gameobject with seeker

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?

It means that the GetComponent is returning null. This most likely means that the Seeker script was not added to the object.

If you are trying to add a Seeker script programmatically, use AddComponent

Which line is the error on?

Could be one of two things

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.

fix B by having closests actually equal something