EditorGUILayout.Popup 选项没有改变
EditorGUILayout.Popup option is not changing
使用这个简单的代码我显示了一个下拉列表
int selected = 0;
///*
string[] options = new string[]
{
"Start With", "End With", "Contains",
};
//criteria = EditorGUILayout.Popup("Search Criteria", 2, options);
//*/
criteria = EditorGUILayout.Popup("Awesome Drop down:", selected, options, EditorStyles.popup);
它完美地显示了带有选项的下拉菜单,但问题是当我尝试 select 另一个选项时选项没有改变?缺少什么?
不要使用 "selected" 和 "criteria"。您必须使用相同的 ONE 变量:
int selected = 0;
///*
string[] options = new string[]
{
"Start With", "End With", "Contains",
};
//selected = EditorGUILayout.Popup("Search Criteria", 2, options);
//*/
selected = EditorGUILayout.Popup("Awesome Drop down:", selected, options, EditorStyles.popup);
因为这是您选择的保存方式
使用这个简单的代码我显示了一个下拉列表
int selected = 0;
///*
string[] options = new string[]
{
"Start With", "End With", "Contains",
};
//criteria = EditorGUILayout.Popup("Search Criteria", 2, options);
//*/
criteria = EditorGUILayout.Popup("Awesome Drop down:", selected, options, EditorStyles.popup);
它完美地显示了带有选项的下拉菜单,但问题是当我尝试 select 另一个选项时选项没有改变?缺少什么?
不要使用 "selected" 和 "criteria"。您必须使用相同的 ONE 变量:
int selected = 0;
///*
string[] options = new string[]
{
"Start With", "End With", "Contains",
};
//selected = EditorGUILayout.Popup("Search Criteria", 2, options);
//*/
selected = EditorGUILayout.Popup("Awesome Drop down:", selected, options, EditorStyles.popup);
因为这是您选择的保存方式