So I am basically trying to get the entire Distance thing to work(I am working in C#), but I keep getting the error "UnassignedReferenceException: The variable Destination of 'Player' has not been assigned", I am pretty sure it has to do with the fact that I'm trying to use a prefab, but I have no idea what else to use in this case(Still new to this), my code looks like this:
public GameObject DestinationPrefab;
void Update ()
{
float distance = Vector3.Distance(transform.position, DestinationPrefab.transform.position);
if (distance <= 100)
{
Destination destination = (Destination)gameObject.GetComponent("Destination");
destination.moveDestination();
}
}