Unity3D breakpoint debugging features

Unity3D breakpoint debugging features 

        Breakpoint debugging function can be described as an essential function of the programmer. Unity3D supports js and c # to write the script, but many people may not know, in fact, Unity3D can breakpoint debugging of a program. But this breakpoint debugging functionality is limited using Unity3D own MonoDevelop editor. The use Visual Studio is not enough. I heard a man named UnityVS things you can use VS for Unity breakpoint Debug, but I myself have not tried Ah Zhao.
 
        Well, simply talk about the practice of it:
 
First is to make sure the script editor is designated as the MonoDevelop.
Unity3D breakpoint debugging capabilities - A Zhao - A claw of lamb Zhao
 
Unity3D breakpoint debugging capabilities - A Zhao - A claw of lamb Zhao
 

 

After selecting, you can select Sync MonoDevelop Project in the Project panel, right to open MonoDevelop. 

Unity3D breakpoint debugging capabilities - A Zhao - A claw of lamb Zhao
 
Because of the need to have a script to debug script, so I wrote a very simple script, there are two buttons, press the first "add" button, the program will use a cyclic fashion from 0-9 of the add up the number, then add up the sum. When you press the second button, it will sum to zero. 
Unity3D breakpoint debugging capabilities - A Zhao - A claw of lamb Zhao
 
 
After the written script, the script just drag scene objects above, we are ready to debug. Prior to commissioning, we need to MonoDevelop and Unity3D to connect.
 
The specific method of connecting two kinds:
First, put the current scene to save it, and then turn off the Unity. Back MonoDevelop, press F5 or click the Debug button.
 
Unity3D breakpoint debugging capabilities - A Zhao - A claw of lamb Zhao
In this way, MonoDevelop will open a new interface Unity3D, this time the connection is complete.
 
 
The second method, without having to turn off the Unity, select Attach MonoDevelop under the Run menu to Process 
Unity3D breakpoint debugging capabilities - A Zhao - A claw of lamb Zhao
 
 
Unity and selection process, click the Attach button. 
Unity3D breakpoint debugging capabilities - A Zhao - A claw of lamb Zhao
 
 At this time, MonoDevelop will now contact the Unity.
 
Once connected the Unity3D, debug button on the right becomes available, we choose the window display Debug.
Unity3D breakpoint debugging capabilities - A Zhao - A claw of lamb Zhao
 
The following script debug mode position will be more than two windows. 
Unity3D breakpoint debugging capabilities - A Zhao - A claw of lamb Zhao
 
Back to Unity, click the Run button, you will see just the script has been running. There are two buttons. 
Unity3D breakpoint debugging capabilities - A Zhao - A claw of lamb Zhao
 
Back MonoDevelop, in the script we hit a breakpoint (on the left in the row number Tap) 
Unity3D breakpoint debugging capabilities - A Zhao - A claw of lamb Zhao
 
 Then back inside Unity, click the first button "add". This time the breakpoint takes effect, the program will be suspended, MonoDevelop jump breakpoint line.
 
Unity3D breakpoint debugging capabilities - A Zhao - A claw of lamb Zhao
 
Keep your eyes Locals debug information below, you will see the value of the variable in the current state and the sum of i. 
Unity3D breakpoint debugging capabilities - A Zhao - A claw of lamb Zhao
 
Use the debug button, let the program run single step
Unity3D breakpoint debugging capabilities - A Zhao - A claw of lamb Zhao
 
We see the actual changes in the current variable i and the sum of.
Unity3D breakpoint debugging capabilities - A Zhao - A claw of lamb Zhao
 
 
Here, breakpoint debugging has been completed.
 
After commissioning finished, I suggest that it is best to disconnect the MonoDevelop and Unity3D. If you continue to open the case, Unity would have been very slow in the state.
 
There are several methods is disconnected, first disconnect the corresponding Debug button has a button you can click off. 
 
Unity3D breakpoint debugging capabilities - A Zhao - A claw of lamb Zhao
 
Or we could just put additional process Detach off. 
Unity3D breakpoint debugging capabilities - A Zhao - A claw of lamb Zhao
 
Unity3D breakpoint debugging capabilities - A Zhao - A claw of lamb Zhao
Or, we can click this button plug, disconnect the Debugger.
Unity3D breakpoint debugging capabilities - A Zhao - A claw of lamb Zhao
 
 
         Both methods are connected Unity, I suggest ways to use the second or additional processes it. After all, you can not always be turned off once the debug Unity Unity and then open again from MonoDevelop. So, writing scripts, the connection Detach off, so when you need to debug, and then the process Attach up, debug on the line.

Guess you like

Origin blog.csdn.net/wwzxbot/article/details/17163925