[Unity][debug] Use the breakpoint of VS to attach to unity for debugging | unity to view local variables, and unity to use vs to debug

need

I want to see the values ​​of some local variables in a certain place. It is too troublesome to write them out one by one with Debug.Log, so I want to use vs to debug, as shown in the figure below
insert image description here

Steps

  1. Break point on the left in the vs scriptinsert image description here
  2. Click on "Attach to Unity" aboveinsert image description here
  3. A dialog box pops up in unity, asking you whether to use debug mode, three options, namely "current session (session)", "whole project (project)", "cancel". Select the current session.
  4. Click the play button in unityinsert image description here
  5. View variable data and custom monitoring variables in vs
    insert image description here

Guess you like

Origin blog.csdn.net/gongfpp/article/details/129110704