Unity 2019.4.1.
I had tried to modify the dropdown size to auto fit with phones.
but seems it cause the app crash?
JobDropDown.ClearOptions();
//dropdown length 4 items
JobDropDown.template.sizeDelta = new Vector2(0, DropDownWidth);//(int)(Screen.height * 0.28);
JobContent.sizeDelta = new Vector2(0, DropDownItemWidth); //(int)(Screen.height * 0.07);
JobItem.sizeDelta = new Vector2(0, DropDownItemWidth);
JobLabel.sizeDelta = new Vector2(0, DropDownItemWidth);
for (int i = 0; i < (int)JobName.Max; i++)
{
JobDropDown.options.Add(new Dropdown.OptionData
{
text = ((JobName)i).ToString()
});
Debug.Log("add " + ((JobName)i).ToString());
}
is it the correct way to deal with dropdown?
Every time I click the dropdown it definitely lag for few seconds,
and the result is crash or show the dropdownlist half to half.
Items is surely add to the dropdownlist.