# Ignore UI layer when recording video

**URL:** <https://forum.magicleap.cloud/t/ignore-ui-layer-when-recording-video/2757>\
**Category:** Unity Development\
**Tags:** development, unity\
**Created:** [October 19, 2023, 5:31pm UTC](https://forum.magicleap.cloud/t/ignore-ui-layer-when-recording-video/2757 "2023-10-19T17:31:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![maxim.khlamov](https://avatars.discourse-cdn.com/v4/letter/m/c57346/32.png) [@maxim.khlamov](https://forum.magicleap.cloud/u/maxim.khlamov)\
**Post date:** [October 19, 2023, 5:31pm UTC](https://forum.magicleap.cloud/t/ignore-ui-layer-when-recording-video/2757/1 "2023-10-19T17:31:20Z")

</div>

Hi all!  
I'm making video recording functionality for my based on the Unity Magic Leap examples. It works fine, but I can't figure out how to ignore the layer that contains my "Stop recording" button and hint. In a typical mobile project I would, for example, make a second camera render that layer and main camera to ignore that layer. That simply save video from the main camera. But as far as I understand, it's not an option for Magic Leap.  
At the same time, the default Magic Leap photo/video capturing functionality that one can trigger from the main menu or by pressing Home button + Bumper shows UI, but doesn't record it. It's the exact functionality I want to achieve in my app.  
So could someone tell me how to fix some config (if any exists) or give me a workaround?

**Unity Editor version** : 2022.3.0  
**ML2 OS version** : 1.3.0-dev1  
**MLSDK version** : 1.11.0 Example project  
**Host OS** : (Windows/MacOS) MacOS

---

<div class="post-metadata">

**Author:** ![aheaney](https://avatars.discourse-cdn.com/v4/letter/a/f08c70/32.png) [@aheaney](https://forum.magicleap.cloud/u/aheaney)\
**Post date:** [October 20, 2023, 6:45am UTC](https://forum.magicleap.cloud/t/ignore-ui-layer-when-recording-video/2757/2 "2023-10-20T06:45:36Z")

</div>

Hello!  
You can use the MagicLeap camera apis to capture video from the rgb camera with or without 3d content composed on top of the camera feed.  
I recommend taking a look at the camera capture sample in the Unity examples project as it demonstrates how you can capture images from the camera, 3d content, or both-

> **[Camera Capture | MagicLeap Developer Documentation](https://developer-docs.magicleap.cloud/docs/guides/unity/sdk-example-scenes/sdk-camera-capture-scene/)**
>
> An overview of the camera capture demo scene included in the Magic Leap 2 Examples Project, which uses Unity's XR Interaction Toolkit.

See \Assets\MagicLeap\Examples\Scenes\CameraCapture.unity  
See \Assets\MagicLeap\Examples\Scripts\CameraCapture\CameraCaptureExample.cs for example usage of the MLCamera apis to capture video using various capture modes.

This documentation page lists the different capture modes that are supported by the MLCamera apis-

> **[MLCamera | MagicLeap Developer Documentation](https://developer-docs.magicleap.cloud/docs/guides/features/ml-camera/)**
>
> The Magic Leap 2 MLCamera API allows developers to capture real and virtual content inside their applications. While the Magic Leap 2 has only one camera to capturing content, two separate streams can be access from the camera at the same time. This...

See documentation pages here for usage of the MLCamera apis-

> **[API Overview | MagicLeap Developer Documentation](https://developer-docs.magicleap.cloud/docs/guides/unity/camera/camera-capture-walkthrough/)**
>
> This guide provides a walk through of creating a custom camera capture script. The sections in this guide were written in a linear flow although each section can also be referenced individually.

Briefly, to capture video without 3d content, you will pass ConnectFlag.CamOnly in the Flags field of the MLCamera.ConnectContext struct that you pass to MLCamera.CreateAndConnect.

Best,  
Adam

---

<div class="post-metadata">

**Author:** ![maxim.khlamov](https://avatars.discourse-cdn.com/v4/letter/m/c57346/32.png) [@maxim.khlamov](https://forum.magicleap.cloud/u/maxim.khlamov)\
**Post date:** [October 26, 2023, 12:04pm UTC](https://forum.magicleap.cloud/t/ignore-ui-layer-when-recording-video/2757/3 "2023-10-26T12:04:54Z")

</div>

Hello!  
Thank you for your answer. I've taken a look at the CameraCapture.unity. But my question remains the same. 3d content that I have is 1) my 3d model 2) my basic UI 3) video recording UI.  
Now all 3 are captured when I set ConnectFlag to capture mixed reality. But what I want is ML to capture real world and 1(model) and 2(basic UI) 3d content without 3 - video recording UI.
