Questions regarding Unity app development for ML2

Hello everyone,

While developing a project in Unity for the Magic Leap 2 device, I've encountered a few issues. Since there are numerous questions, I believe it's best to consolidate them into one topic rather than creating multiple threads.

The questions I'm hoping to find answers to are as follows:

  • How can I directly run the application from Unity onto the device? I've faced an issue when attempting to run the scene on the app simulator; despite initiating the application, the simulator fails to display it. Currently, I'm utilizing device streaming to observe the device output, yet I encounter difficulties projecting the application from Unity onto the device stream.
  • In the device stream, there's a black background rendered behind the scene, which is not present on the headset. How can I eliminate this black background? I've tried to change the background of my XR main camera, but it seems like this setting gets overwritten during the build.
  • The Unity application always loads in portrait mode despite setting the orientation to landscape in both the scene and player settings within the Android tab.
  • Camera capturing isn't possible when the device stream is active.
  • Lastly, I would like to collect logs from the application. I've tried various methods, and the only way that worked for me was using a custom UI logger and displaying logs on the scene. This works fine for some cases, but I need to be able to list all application logs. I attempted to use Debug.Log() and then read from the Log tab in Device Bridge, followed by the tutorial provided at Unity Debugging via Visual Studio | MagicLeap Developer Documentation, but nothing worked.

Unity Editor version: 2022.3.22f1
ML2 OS version: 1.6.0
MLSDK version: 2.1.0
Host OS: Windows 11

@uros.mitrovic If you are creating a new application I recommend using the OpenXR workflow. That said if you want to use the MLSDK with App Simulator support, I recommend starting with the Magic Leap Unity Example Project (v 1.12.0) . Versions 2.0.0 or higher only include examples for the Magic Leap OpenXR APIs.

If you are using the Magic Leap Unity SDK, Downgrading to the 1.12.0 Unity SDK should resolve the issue with the black background, however you can try the following : Passthrough for Capture and Dimming | MagicLeap Developer Documentation . If you are not using the Magic Leap Unity SDK, you will not be able to stream a transparent background at this time. This is due to how 2D android applications are rendered. If you create a new topic and provide some more information about your use case I can send your request to our voice of customer team.

Currently we do not support rendering 2D Android Applications in landscape mode. However, if you create a new topic and provide some background about your use case I forward your request to our voice of customer team.

Regarding the camera Capture - Please make sure you are using the CV Camera inside your application so that they Mixed Reality Camera can be accessed by the system. (A Camera stream can only be accessed in a single process.)

When you say that you were not able to read the logs, were you unable to access the logs in device brigs from the Magic Leap Hub? We use the standard AOSP logging, so you can connect , profile and debug your application as if it were running on an Android device. Here are a few resources.

https://docs.unity3d.com/Packages/com.unity.mobile.android-logcat@1.4/manual/index.html