LoginSignup
1

More than 5 years have passed since last update.

[Unity]uGUIのDropdownでリストの描画順がおかしい時の対処法

Posted at

SortingLayer設定してるとこうなる

dropdown.gif

原因はDropdown自体は前面のレイヤーでも展開した時のリストはDefaultに表示されるから(なんでや!)

対応方法

ゴリ押し

DropdownSortingLayer.cs
using UnityEngine;

public class DropdownSortingLayer : MonoBehaviour
{
    public string SortingLayerName = "Front";
    void Awake()
    {
        Canvas canvas = GetComponent<Canvas>();
        if (canvas != null)
            canvas.sortingLayerName = SortingLayerName;
    }
}

結果

dropdown2.gif

参考

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1