what does Vector3.Distance() return ?

Apparently it returns an object, but I’m looking for a float. I want to do something like if(dist < 5f) for example but I can’t compare an object and a float with <
… any advice?

What error are you getting? Can you show us the code?

Vector3 is XYZ coordinates
float is a number (4, 700, 15.6, 3.14159, etc…)

Vector3 position1 = new Vector3(1, 0, 0);
Vector3 position2 = new Vector3(0, 0, 0);
float totalDistance;

void Start() {
totalDistance = Vector3.Distance(position1, position2);
Debug.Log(totalDistance);
}

This should say 1 meter in the debug window.

Note: Keep in mind Vector3.Distance DOESNT substract the two, it compares them, so it won’t ever have a negative value.

Vector3.Distance should return a float.

float dist = Vector3.Distance( vectorA, vectorB);

will return a float of the distance between a and b.