TextMeshPro dropdown causes crash due to layering issue

I’ve just submitted a bug report for this (IN-67372), but essentially the issue is that we have our ‘Ignored objects layer mask’ set to ignore everything except UI and Polyspatial. However, when activated, the dropdown component creates an object called Blocker in the hierarchy with the Default label, which creates a KeyNotFoundException

Have a workaround using a custom dropdown script, for now:

using UnityEngine;
using TMPro;

public class NKDropdown : TMP_Dropdown {
#if UNITY_VISIONOS
    protected override void Awake() {
        base.Awake();
        gameObject.AddComponent<global::Unity.PolySpatial.VisionOSHoverEffect>();
    }
#endif

    protected override GameObject CreateBlocker(Canvas rootCanvas) {
        var blocker = base.CreateBlocker(rootCanvas);
        blocker.layer = gameObject.layer;
        return blocker;
    }
}
1 Like

Thanks for the report. I’m looking into this now but I have no real fix as of yet. For now, the workaround you have implemented here is what I would suggest to go with at this time.

Quick update: The uGUI and TMP teams responsible for the Dropdown control are taking lead on this issue and are working on a fix. I don’t have an ETA for that at this time but wanted to let you know this is actively being resolved.

1 Like