Questions about segmented dimmer

Give us as much detail as possible regarding the issue you're experiencing.

Unity Editor version: 2022.2.18
ML2 OS version: 1.2.0
MLSDK version: 1.2.0
Host OS: MacOS

I have a question regarding segmented dimmer. I wanted to change the effect of the darkness of segmented dimming, so I made it possible to change the DisplayOpacity of the SegmentedDimmerMaterial by using the slider in the following code.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.XR.MagicLeap;

public class dim_controller : MonoBehaviour
{
    public float opacity = 1.0f;

    [SerializeField]
    private UnityEngine.UI.Slider slider;

    void Start()
    {
        Renderer renderer = GetComponent<Renderer>();
        renderer.material.SetFloat("_DimmingValue", opacity);
        slider.value = opacity;
    }

    public void SetValue(float value)
    {
        Renderer renderer = GetComponent<Renderer>();
        renderer.material.SetFloat("_DimmingValue", value);
    }
}

When I change the slider, I can see that the DisplayOpacity is changing, but when I run the application in ML2, the darkness does not change at all. Why is this?

Just to confirm, you've already followed the proper steps to set up the Segmented Dimmer using URP? Have you tried testing this script on a different URP material?
Do you see the _DimmingValue change in the console log? Can you clarify what Game Object this script is attached to?

Additionally, can you provide the Unity SDK version you are using?

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