Hi, I am testing the global dimming of magic leap 2 with this code:
using UnityEngine;
using TMPro;
using UnityEngine.XR.MagicLeap;
public class DimmerTest : MonoBehaviour
{
public float period = 2.0f;
[SerializeField, Tooltip("Debug bar")]
private TextMeshProUGUI DebugText;
void Update()
{
float t = (Time.timeSinceLevelLoad % period) / period;
float dimmer = -0.5f * Mathf.Cos(2.0f * Mathf.PI * t) + 0.5f;
try
{
MLGlobalDimmer.SetValue(dimmer);
Debug.Log("Set dimmer to " + dimmer);
DebugText.text = $"Dimmer level: {dimmer:0.00}";
}
catch (System.Exception e)
{
Debug.Log(e.Message);
DebugText.text = $"Error setting dimmer: {e.Message}";
}
}
}
When I test this code with both App simulation/real device, it successfully printed out the Dimmer level with no error output. Also, the code are all complied correctly. However, in my view of glasses, the background didn't changed at all while it should be frequently changed from black to light as the doc below shows.
For information of my system, I am on WIndows 10, using unity 2022.2.0.f1, MLC SDK is 1.5.0 and Magic Leap Application Simulator (ZI) Runtime version is 3.8.0.20231028, and the ML2 OS version is 1.4.1.
Thank you, I will try that but not sure if there will be some conflict if I downgrade to 1.12.0. Is XR Workflow no more support global dimming/have some potential problems with SDK version higher than 1.12.0? Will that be fixed in the future as we also want to add pupil size detection if it is supported in the future version.
Also, I don't think there are MLSDK package with version 1.12.0 on Magic leap hub. If you mean the Unity package, I am currently using 2.0 and can downgrade to 1.12.0
Hi, you are correct. In the setting part, the Global dimming is disabled with notification: disabled due to display preset
However, I didn't found any options in display setting page to enable it. May I have some hints about how to enable it?