-
In Unity > Preferences > External Tools, set
External Script Editorto Visual Studio (make sure theEditor Attachingoption is checked -
In Visual Studio, set a breakpoint on the line where you want the debugger to stop.
-
In Visual Studio, attach the code editor to the Unity Editor.

- In Unity, enter play mode.
For details, see the official documentation: https://docs.unity3d.com/cn/2019.4/Manual/ManagedCodeDebugging.html