How to Control the Exposure Mode of World Camera

Hi everyone,

I'm trying to use the World Camera to detect infrared images, and I noticed in the documentation that it seems possible to select the exposure mode through PixelSensorAutoExposureMode.

In the World Camera Example, under the Custom Configuration Example, I found this part of the script that allows selecting the exposure mode:

[Header("Auto Exposure Settings")]
[Tooltip("Exposure Mode: Environment (0) or Near IR (1)")]
[Range(0, 1)]
public PixelSensorAutoExposureMode autoExposureMode = 0;

However, when I try to implement this example in Unity, I encounter the following error:

Unsupported enum type 'MagicLeap.OpenXR.Features.PixelSensors.PixelSensorAutoExposureMode' used for field 'autoExposureMode' in class 'WorldCameraPixelSensor'

Does anyone know how I can resolve this issue and successfully control the exposure mode of the World Camera to detect infrared images?

Thanks in advance for your help!

Unity Editor version: 2022.3.4
ML2 OS version:1.10.0
Unity SDK version:2.5.0
Host OS: (Windows/MacOS) Windows 11

Hey @tangjq15

Welcome to the Magic Leap Developer Forums!

This error is due to the fact the PixelSensorAutoExposueMode Enum is a ulong, 64 bit type.

Unity does not support serializing 64 bit types, only 32 bit.

That's why you are getting this error when the application recompiles.

I'll pass this along to the correct team to see if it is necessary for this enum to be a ulong, but at first glance I assume there is a reason, I just don't know it off the top of my head.

Your application should still build just fine even with this error being thrown in your editor.

Try continuing what you were doing and just ignoring the error and see if that works out for you.

Hope this helps and again, welcome to the Magic Leap developer community!

Have you looked at the Pixel Sensor example in the 2.5.0 Magic Leap Unity Example Project?

Thank you for your reply, I tried to ignore the error and build directly but it failed, do I need any special settings?

Yes, but unfortunately it doesn't have an exposure mode setting option.

We're still looking into this for you!

Something may have changed in a recent version of the SDK affecting exposure settings for the pixel sensor.

I'll let you know once I have some more information.

It seems nothing of note has changed so the example here should still be working as intended:

Are you getting any other errors than the one you specified in your original post?
Again that error shouldn't prevent you from being able to build so I suspect there is something more going on.

For reference, I was able to use the example linked above and build an .apk even with the error being thrown.

If you can provide any additional details you think are relevant, please do!

Also, the team agrees that the PixelSensorAutoExposureMode enum type should be changed to a uint instead of ulong, so that may be coming in a future update.

If you haven't yet, I would also try opening the Magic Leap Examples project in Unity, bringing in your WorldCameraPixelSensor script, and seeing if that project will build.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.