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 https://developer.arm.com/graphics.

  • 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:

1.
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
2.
Locate the libMGD.so 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 libMGD.so library here.

Figure 9-2 Copy libMGD.so to Unity project


3.

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

Build your apk.

Figure 9-3 Check the Development Build option


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

Figure 9-4 Enabling the MGD daemon


7.
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.
8.
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