Unity ScreenCapture Functionality

Hi, I'm having trouble saving a full sized screenshot. I'm able to save the screenshot in two different ways: Capture the screen width and height using a texture. This call works fine for ML1 and other platforms:


The file is written, but it always writes it as 69 bytes with a 1x1 pixel on ML2

1 Like

Hi @alex,

That call is not supported on ML2 because for Android Unity uses the app "Window" to execute screen capture but that window is not generated in the ML2 OS. To get a screen capture from ML2 inside Unity, please use the MLCamera API from our ML2 Unity SDK Package to do an image capture. You can reference the Camera Capture example scene from the Unity Examples package also available on ML Hub to get started.

1 Like

Another potential option would be to use Device Stream from within the ML Hub menus, capturing a screenshot from your host OS via the incoming RTSP stream window.

1 Like

Thank you for the information. I'm investigating the MLCamera API.

So I have a few questions about running the Magic Leap Unity examples. Firstly, I noticed these examples were built and running version 2022.2.0a19:


I went Unity's beta archive: Unity 2022.2b - Unity and I don't see 2022.2.0a19 available for download.

2023.1.0a10 seems to work, but how do you move the cursor when running in the editor? Should I be using unity editor 2022.2.0b8 instead?

Secondly when I opened the examples, the default platform is the PC. Should the default platform be configured for Android so it can run on the ML2?

1 Like

Our official recommendation is for 2022.2.0b7 or 2022.2.0b8 for the September release.

1 Like

Please switch the platform to Android, yes, when preparing to build.

1 Like