From what I read on the Docs and what other people have put I should just have to put it after “out enemySight”. But it doesn’t seem to want to increase. It stays at 0.6 max dist.
The raycast works well. Your would detect a hit up to 500 units. If you don’t provide a distance it would even go to infinity. So no matter how far away an object is, it will hit it.
In your case you’re just hitting something that’s very close to your starting point. The if statement of the Raycast will only evaluate to true when the ray has hit something. If it doesn’t hit any thing, it won’t enter your block below the if.
You might want to add this Debug.Log inside your if body:
Debug.Log("I hit " + enemySight.transform.name, enemySight.transform);
This should print out the name of the object you’ve hit. Also if you click on the debug log message it should highlight the object that “catched” the raycast.