Dropdown not showing after canvas set active

Unity 5.6.0f3

Place a Dropdown on a canvas (Screen Space - Overlay).

Run.

Dropdown works fine with default options.

Set canvas inactive.

Set canvas active.

Dropdown no longer shows. It is still there but I can not get it to show (except in Scene view by dragging it to the side of the canvas).

Any ideas?

For those who still have the problem and want a simple workaround:

Create this simple script and add it to the DropDown GameObject:

public class DropDownFix : MonoBehaviour {

    public string sortingLayer = "UI"; //Or what ever layer you want it to be

    public void OnDropDownClicked() {
        Transform droplist = transform.Find("Dropdown List");

        if (droplist != null) {
            droplist.GetComponent<Canvas>().sortingLayerName = sortingLayer;
        }
    }
}

And just add an Event Trigger to the dropDown Gameobject with an Pointer Click event calling the OnDropDownClicked() function.

122904-temp.png

Try to set the DropDown’s anchor point as per your need and than check.

Not sure if this will fix your issue, but I was having a very similar issue. Unity adds a canvas component to the Dropdown template at run-time with Override Sorting checked and the sorting layer set to Default instead of UI. To fix I copied the values from the canvas component after unity created it and pasted it into a canvas component I added myself and then set the layer to UI (only difference I saw was Order in Layer was 30000). Alternatively you could uncheck override sorting but then you’d have to make sure nothing else clips it. No idea why it doesn’t copy the sorting layer from the parent object at run-time.

Hi folks, I’m fairly new to Unity as well, and came across this post because I had the same issue. I found a way to solve the problem though. I noticed, in the editor, that the component ‘Dropdown List’ is never deleted, only deactivated with the rest of the object. As the canvas(‘Dropdown List’) is created at runtime, all you have to do is make a call to delete the canvas as the dropdown box is shown again. The next time you click it the dropdown box will appear again.

DestroyObject (dropDownBox.GetComponentInChildren<Canvas> ().gameObject);

I hope this helps!

I solved this issue by adding a Canvas component to the “Template” object and uncheck “Override Sorting”, so that the dynamically generated “Dropdown List” will appear on the correct sorting layer.

They say that it is fixed from level 5.6.0p3, but I am on level 5.6.3p1 and still have the problem.