Steps to reproduce:
1. Create new Unity project using Universal 2D Template
2. Import the provided script “F3_SegmentDistanceRepro.cs” to the project
3. Create an empty GameObject in the scene and add “F3_SegmentDistanceRepro.cs” to it
4. Enter Play Mode
5. Observe the Console window
Actual results:
SegmentDistanceResult.sqrDistance returns the distance (not the squared distance), and SegmentDistanceResult.distance returns the square root of that value instead of the actual distance:
- gap 3 → distance = 1.7321, sqrDistance = 3.0
- gap 5 → distance = 2.2361, sqrDistance = 5.0
Expected results:
SegmentDistanceResult.distance returns the Euclidean distance between the closest points, and SegmentDistanceResult.sqrDistance returns its square:
- gap 3 → distance = 3.0, sqrDistance = 9.0
- gap 5 → distance = 5.0, sqrDistance = 25
Reproducible with versions: 6000.7.0b1, 6000.7.0b2, 7000.0.0a1
Can’t test with versions: 6000.6.3f1, 6000.7.0a6 (errors in the Console when creating script)
Tested on (OS): macOS 27 (Apple Silicon)