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).
PATHmust 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 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
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
- To install the Unity application with MGD support on an Android device, type:
adb install -r
- 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 libMGD.so library is listed.
Figure 9-4 Enabling the MGD daemon
- Launch MGD on your desktop. Click on the 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