Using Android Studio for Unity Debugging

Whew! What a slowly productive day, yet productive nonetheless. I’ve been spending time trying to get the in-app purchases system working, and to a point, I wasn’t able to debug in Unity, since some of the messaging was using Android calls, via the Android Native Plugin by Stan’s Assets from the Unity Asset Store.

So, for Unity developers looking to put out an Android product, here’s a tip for you that you may or may not know. Android uses something called logcat for capturing log messages from a device or emulator. Most likely you’ll be testing on a device, such as a phone or tablet. I had been using the freely available Android Studio, which is the main development IDE for Android apps if you aren’t using an alternative authoring platform such as Unity, for debugging. I would create a dummy project in Android Studio, and open up the Android tab to expose the logcat window. And recently, I discovered that the simplest method would be to use the Device Monitor (monitor.bat) that’s available in your <android>/sdk/tools/ directory.

Either method you use, you can easily set the Log level, and filter by specific terms used in your debug output strings, or simply use “Unity” to filter the output from Unity, including your Debug.Log() calls.

Hope this helps someone. Anyway, happy coding!

This entry was posted in Dev, Programming. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.