How to end an infinite loop in Unity

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

Guess you like

Origin blog.csdn.net/weixin_43673589/article/details/123337059