Raycast stops working after going over 500k

I have a raycast in my scene that is measuring the distance to an object that is moving away from it, the raycast shows correct values up to 499818.75 after that it goes back to 0 and stays there. Is there a way to get values higher then that from a raycast?

I’m not sure but my guess is that maybe raycasts don’t work at that distance because you are starting to get into distances where floating point precision starts to break down. I’m not sure what your project is, but Unity cannot handle distances this large because floating point numbers cannot correctly store values that large. If you choose to work with a project this large you will likely run into more issues due to this. Commonly games that require distances this large have workarounds for this so that objects aren’t actually this far apart. If you are sure you want to use distances this large however, I recommend using a series of raycasts