You copied the Doc URL to your clipboard.

Enabling MGD

This describes how to enable MGD in Unity.

MGD library loading is integrated in Unity. You can use MGD with Unity to profile OpenGL ES applications.

To enable MGD, you require the following:

  • Unity 5.6 or higher.

  • Your Android device must have Android 4.2 or above.

  • The latest version of MGD from

  • Android Software Development Kit (SDK).

  • Your PATH must include the path to the adb binary.

  • You must have a valid ADB connection to your target device. ADB must be able to return the ID of your device with no permission errors and you must be able to execute applications. For more information, see your Android device documentation.

  • Your target device must permit TCP/IP communication on port 5002.

To add MGD support to a Unity application, follow these steps:

Locate the MGD installation folder. For example, on Windows OS the default installation path is C:\Programs Files\ARM\Mali Developer Tools\Mali Graphics Debugger vX.Y.0.
Locate the subfolder target\android\arm\ that contains the MGD Android Application MGD.apk.
To install this apk on the Android device where you want to profile your Unity game or application, type this command:
adb install -r MGD.apk
Locate the library in the MGD installation folder under target\android\arm\unrooted\armeabi-v7a\.
In your Unity project, create the subfolder Assets\Plugins\Android\. Place the library here.

Figure 9-2 Copy to Unity project


In the Unity Build Settings dialog window, check the Development Build option. This instructs Unity to package library into the apk and load it at runtime on the host device.

Build your apk.

Figure 9-3 Check the Development Build option

To install the Unity application with MGD support on an Android device, type:
adb install -r YourApplication.apk
To enable MGD to connect to the daemon over USB, run the following command on the host:
adb forward tcp:5002 tcp:5002
Launch the MGD Android application on the host and enable the MGD Daemon by sliding the button. Your Unity application linked to library is listed.

Figure 9-4 Enabling the MGD daemon

Launch MGD on your desktop. Click on the connect to target icon to connect to the target and start tracing.
MGD waits for trace input.
Tap on your application where it is listed by the MGD Android application, on your device. The MGD interceptor sends all the OpenGL ES and EGL calls made by your application, to the MGD host application.

The following image shows MGD tracing Unity with OpenGL ES:

Figure 9-5 MGD tracing Unity with OpenGL ES