Using SqrMagnitude

Hi I am trying to convert my very expensive
Vector3.Distance(p1,p2) to use SqrMagnitude instead

My code:

Vector3 p1 = path.startPoint;
Vector3 p2 = GetFeetPosition ();
float magn = (p1-p2).SqrMagnitude;

But I keep getting the error Cannot convert method group SqrMagnitude' to non-delegate type float’.

Thanks in advance

It is ‘sqrMagnitude’ with a small ‘s’. But I recommend you run a test. I’ve been involved in two questions in the last year where OP (original poster) claimed that Vector3.Distance() was faster. In theory it is possible. I’ve never run the test to see.