Dropdown List's Sorting Layer not compatible with multiple canvases with different sorting layers

related issue: Unity Issue Tracker - [UI] Dropdown list does not copy the parent canvas layer when the panel is opened

At File TMP_Dropdown.cs, Line 816:

            // popupCanvas used to assume the root canvas had the default sorting Layer, next line fixes (case 958281 - [UI] Dropdown list does not copy the parent canvas layer when the panel is opened)
            m_Template.GetComponent<Canvas>().sortingLayerID = rootCanvas.sortingLayerID;

This makes the sorting layer of dropdown list always changed to the sorting layer of the root canvas, and I can not set the sorting layer manually.

However, when I have a hierarchy like:

└─ Canvas1(Sorting Layer 1)
      ├─  Canvas2(Sorting Layer 2)
      │      └─Dropdown1
      └─  Canvas3(Sorting Layer 3)
             └─Dropdown2

The sorting layers of Dropdown1 and Dropdown2 are always set to “Sorting Layer 1”, which makes them render behind “Sorting Layer 2” and “Sorting Layer 3”.

Hey, if you think you found a bug, please report it through Help > Report a Bug inside the Unity Editor.