Search Unity

Any way to make EditorGUILayout.Popup select the right item but not just remember the index

Discussion in 'Immediate Mode GUI (IMGUI)' started by yurilin1, Oct 10, 2017.

  1. yurilin1

    yurilin1

    Joined:
    May 22, 2013
    Posts:
    102
    I use an editor window and an asset database to keep data
    like
    xxx.ItemID = EditorGUILayout.Popup(xxx.ItemID, items);

    the items is a dynamic list which read from another window editor.Which means it always changes!
    But the EditorGUILayout.Popup only remembers the index of it.
    So When the items list removes a thing.The selected item index in popup menu was not the previous place anymore!
    So it chooses a wrong item AUTOMATICALLY

    Any way to let the popup list remember the enum name or some unique id so won't let the selection mess up when its data changes!

    Thanks