"Reprint" The breakpoint debugging function of Unity3d

Source: Internet
Author: User

Original link: http://liweizhaolili.blog.163.com/blog/static/162307442013214485190/

Breakpoint debugging is a must-have feature for programmers. Unity3d supports the writing of JS and C # scripts, but many people may not know, in fact, Unity3d can also be a breakpoint debugging program. There are two ways to debug, one is to use Visual Studio with Unityvs to debug, and the other is to use MonoDevelop's own debugging capabilities. First of all, say Unityvs. Thanks to netizens ' reminders, Unityvs has been acquired by Microsoft and is now called Visual Studio Tools for unity, free to download. Search for downloads on the Internet, corresponding to your own vs version download:

There is only one installation package after download:
Direct installation: After the installation is complete, the new Unity Project will have an optional import package, or you can import the package after the project has been established:
Import:
After importing, there is an extra option in the main menu:
Choose on vs Open:
will open vs there will be a more button in VS, attach the process to unity next, you can debug the normal breakpoint. The second is to use MonoDevelop debugging: First of all, you must first designate the Script Editor as MonoDevelop.

After the

is selected, you can right-click Sync monodevelop Project in the project panel to open MonoDevelop.  

  Because scripts are needed to debug scripts, I wrote a very simple script with two buttons that, when the first "Add" button is pressed, adds the number from 0 to 9 in a loop, and then sums it up to sum. When you press the second button, the sum is zeroed out.     after writing the script, drag the script to the scene object, we are ready to debug. Before debugging, we need to connect the MonoDevelop and the Unity3d.   There are 2 ways to connect: First, save the current scene, and then turn off unity. Go back to MonoDevelop, press F5 or click the Debug button.   This way, MonoDevelop will open a new Unity3d interface, when the connection is complete.    second method, without turning off unity, select Attach to process    under the MonoDevelop Run menu and select the Unity process and click the Attach button.     this time, MonoDevelop is connected to unity.   When the Unity3d is connected, the Debug button on the right becomes available, and we select Debug for the window display. There are two more windows in the location below the  debug mode script.    Back to Unity, click the Run button and you'll see that the script is already running. There are two buttons inside.    back to MonoDevelop, in the script we hit a breakpoint (line number to the left)     then go back to unity, click the first button "add". At this point the breakpoint works, the program pauses, and MonoDevelop jumps to the line of the breakpoint.    Watch the locals information below debug to see the value of the variable i and sum in the current state.    Use the Debug button to let the program run in one step   we see the actual change of the current variable i and sum.    here, the breakpoint debugging is complete.   After commissioning, I recommend that you break the connection between MonoDevelop and Unity3d. If you keep driving, unity will always be in a state of great card.   Disconnection method is also a few, first corresponding to the Debug button has a disconnected button, you can directly click to disconnect.     or we can detach the process just attached.    or, we can click this Plug button to disconnect the debugger.   

"Reprint" The breakpoint debugging function of Unity3d

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.