Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/274.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/195.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 统一下拉导致崩溃_C#_Android_Unity3d - Fatal编程技术网

C# 统一下拉导致崩溃

C# 统一下拉导致崩溃,c#,android,unity3d,C#,Android,Unity3d,统一2019.4.1 我曾试图修改下拉列表的大小,使其自动适应手机 但它似乎导致了应用程序崩溃 JobDropDown.ClearOptions(); //dropdown length 4 items JobDropDown.template.sizeDelta = new Vector2(0, DropDownWidth);//(int)(Screen.height * 0.28); JobContent.sizeDelta =

统一2019.4.1

我曾试图修改下拉列表的大小,使其自动适应手机

但它似乎导致了应用程序崩溃

        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());
            
        }
JobDropDown.ClearOptions();
//下拉长度4项
JobDropDown.template.sizeDelta=新向量2(0,DropDownWidth)//(内部)(屏幕高度*0.28);
JobContent.sizeDelta=新向量2(0,DropDownItemWidth)//(内部)(屏幕高度*0.07);
JobItem.sizeDelta=新向量2(0,DropDownItemWidth);
JobLabel.sizeDelta=新向量2(0,DropDownItemWidth);
对于(int i=0;i<(int)JobName.Max;i++)
{
JobDropDown.options.Add(新建Dropdown.OptionData
{
text=((作业名)i).ToString()
});
Log(“添加”+((JobName)i.ToString());
}
这是处理下拉列表的正确方法吗

每次我点击下拉列表,它肯定会滞后几秒钟

结果是崩溃或半对半显示下拉列表

项目肯定会添加到下拉列表中