Turn on Unity's debug mode before playback
If an infinite loop occurs during playback, attach VS to the Unity process
This loop condition is always true, so it can't jump out
run down
Run to the judgment position of this loop condition
We can mouse over a variable, view its value and modify it
Double click to change distance to 1
This is relative to changing the distance of the ray detection to 0, and the return value will be false
Execute again to jump out of the loop
At this point, Unity may still be stuck
We only need to suspend the debugging of VS and it will return to normal