Find Raycast Distance

How can I cast a ray and find the distance from where it started to where it hits an object? I’m using Unity Free and JavaScript.

Hello,
you can use the RaycastHit.distance.

(You can find the documentation for it here RaycastHit.distance)

Good luck!
Best Regards