- Home /
GUILayout.Popup bug?
Hi guys, im using the GUILayout.Popup to display a string array likes so:
elementPosElement = EditorGUILayout.Popup(elementPosElement, ePosE);
so elementPosElement is an int and ePosE is a string[].
So my issue is when i have two or more strings in ePosE that are equal, the popup only shows the first one in the array and excludes the rest. Is this a bug or supposed to be this way, if so why?
Edited: added example image
I believe that is the expected functionality. If there are two objects of the same name, how do you know which one you're selecting?
Ah, perhaps you could add in the type in parenthesis like
Height-10% (Spacer)
Username (Label)
Username (TextField)
EDIT: so your array would look like { "Height-10% (Spacer)", "Username (Label)" , "Username (TextField)"}
What about just adding a prefix to each item: "1. Apple", "2. Orange", "3. Apple", etc?
Well I don't think this is expected. Nothing in the docs, at least, say that the strings should be unique, no matter how little sense it makes to have two strings with same name in a select. However, as said you should avoid this simply because it results in bad usability (that's probably why Unity is enforcing unique strings). So simply prefix or suffix the string with an identifier when you notice that you have duplicated options. :)
Your answer
Follow this Question
Related Questions
Is it possible to have a spectrum analyzer display for each song in a playlist? 1 Answer
Overlapping GUI Button priority 3 Answers
individual object menu 0 Answers
GUI Popup problem…! 1 Answer