Unity Android real machine debugging, unityandroid

Source: Internet
Author: User

Unity Android real machine debugging, unityandroid

Official Document https://docs.unity3d.com/Manual/AttachingMonoDevelopDebuggerToAnAndroidDevice.html

However, according to the official documentation, many people will see no device problems in the monodevelop Attach to Process dialog box.

 

After some tests, I found a solution.

Process 1: Enable adb and then enable unity

Do not open unity before starting work every day, but set adb before opening unity and monodevelop. Next, let's talk about how to enable unity first.

Make sure that the computer and mobile phone are in the same subnet. For example, if my computer is ip 192.168.5.44 and my mobile phone is 192.168.5.174. Unity debugging uses wireless networks and mobile phones instead of USB cables.

Connect your phone and computer with usb .. In fact, if adb is set first, it can be completely disconnected.

Set adb, open cmd, and enter

adb tcpip 5555

This is a fixed 5555, not dynamically changing based on the situation.

Cmd output

* daemon not running. starting it now on port 5037 ** daemon started successfully *restarting in TCP mode port: 5555

Enter the adb connect mobile ip address again

adb connect 192.168.5.174

Cmd output

connected to 192.168.5.174:5555

Enter adb devices to confirm that the device is connected. The two devices are actually the same mobile phone. One is the network connection name and the other is the usb connection name.

Then open unity. In the Project window, right-click the Assets Directory and choose Sync MonoDevelop Project. This will enable MonoDevelop. Encoding starts and breakpoint is set when debugging is required

Start Debugging. In the unity menu, choose File> Buld Settings> Android, and check the Development Build and Script Debugging. Set this item for the first time. For subsequent Debugging, run build directly.

Next, File-> Build & Run (Ctrl + B). After a long wait, the app runs on the mobile phone. There is a "Development Build" in the lower right corner of the interface ". Switch to MonoDevelop. In debug mode, click Run. The Attach to Process dialog box appears. Select a device to start debugging.

Process 2: enable unity and adb

This method ensures full USB cable connection.

After programming and debugging in unity and MonoDevelop, do not rush to Build & Run and set up Build Setting. Refer to process 1. In this case, start adb first, refer to process 1, disable unity and monodevelop, and then restart them.

Then Build & Run. The subsequent process is the same as the process.

 

Related Article

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.