- Home /
UI Dropdown does not drop.
Hello.
I have encountered interesting problem. I place my Dropdown UI element in my canvas. By default this dropdown already has three elements to choose.
Then I click to start. When I click to this Dropdown element, nothing happens. Its hidden content which is needed to be chosed, does not show.
Why this is happening?
I am having the exact same problem, were you able to find a fix?
I'm experiencing something similar to this too. $$anonymous$$y dropdown works at first, but it stops working when I disable and re-enable it. It's very clearly being clicked but the menu refuses to open.
For those from google:
Be sure that you don't have an invisible UI element overlapping your dropdown. This commonly happens with Text elements that have a large bounding box to hold larger input.
The canvas detects clicks according to the the display order of the elements. So an empty, textureless, transparent element will intercept clicks for any element that renders behind it.
Answer by korober · Jul 26, 2018 at 03:40 AM
Also, check child object with name "Dropdown List" in DropDown root. It appears when you click on component to show drop down list. "Dropdown List" has Canvas and it's sorting layer is Default after creating. You can have other canvases on your scene with other sorting layers that will be hide your drop down list.
p.s. Also you should change sorting layer for object with name "Blocker". Blocker helps to close drop down list after tap (or click) on any other screen position.
I've wrote short script for example (is uses UniRx - reactive extensions and TextMesh Pro Drop Down List):
[RequireComponent(typeof(TMP_Dropdown))]
public class DropDownCanvasLayerSetter : MonoBehaviour
{
private TMP_Dropdown _dd;
private const string BlockerObjectName = "Blocker";
private const string CanvasDefaultSortingLayerName = "UI";
private void Awake()
{
_dd = GetComponent<TMP_Dropdown>();
_dd.ObserveEveryValueChanged(dropdown => dropdown.IsExpanded)
.Where(isExpanded => isExpanded)
.Subscribe(isExpanded =>
{
var canvases = _dd.GetComponentsInChildren<Canvas>().ToList();
var blocker = FindObjectsOfType<Canvas>().FirstOrDefault(canvas => name == BlockerObjectName);
if (blocker != null) canvases.Add(blocker);
foreach (var canvase in canvases)
{
canvase.sortingLayerName = CanvasDefaultSortingLayerName;
}
}).AddTo(_dd);
}
}
Answer by gbuckner · Oct 20, 2016 at 08:01 AM
I am having the same issue. I am using Unity version 5.4.2f1. The dropdown was working in my last version; however, not that I updated to the aforementioned version it does not work properly. Basically, i am able to select an item out of the drop box from the start; however, if I tap on the dropdown box a second time in order to make another selection it will not expand to show me my other options. PLEASE HELP...THIS IS FOR AN APP THAT IS IN PRODUCTION...
Answer by hkhurana82 · Apr 18, 2017 at 04:39 PM
Seems this issue is fixed in 5.6 onwards but I have a work around for 5.5:
After making the canvas inactive, destroy the "Dropdown List" child of the DropDown. This will get created automatically when the drop down is rendered next time.
Transform dropDownList = canvas.transform.FindChild ("<path>/<to>/Dropdown List");
if (dropDownList != null) {
Destroy(dropDownList.gameObject);
}
Worked for me.
Answer by BunnyTales · Mar 01, 2018 at 04:43 PM
Having this issue in 2017.2. Weirdly enough the dropdown only drops down when its anchor and pivot are in the center of the screen. If I set its anchor and pivot to the top of the screen then it won't drop down.
For the record, it's still an issue. I have this in 2017.4.0f1
Answer by javier-mazzurco · Jun 03, 2018 at 10:40 PM
Excelent workarround here https://answers.unity.com/questions/1350194/dropdown-not-showing-after-canvas-set-active.html
Your answer
Follow this Question
Related Questions
Make image follow your cursor 1 Answer
Changing anchor positions on UI? 0 Answers
new Dropdown implementation incomplete? 1 Answer
Move UI object to center of screen while maintaining its parenting 2 Answers
Multiple Cars not working 1 Answer