|
The EditorGUILayout.Popup method displays a drop-down menu so the user can select from a list of strings. However, any slashes in the option strings are converted into another level of child menu. This is cool when you want nested menus, not so cool when you're trying to give the user a list of filenames to choose from. Is there a way to prevent this behaviour? Or other suggestions on how to easily throw a drop-down menu into my EditorWindow?
(comments are locked)
|
|
Turns out backslashes work fine, so I'm converting front-slashes to backslashes for use as menu options, then converting the result back to front-slashes when I use the filename (redundant under Windows, where either slash works for the file system API's, but needed on Mac). I did notice a few times when backslashes seemed NOT to work, but I believe this was because my editor window class was not being fully reinitialized as I was modifying its code and recompiling. (Seems odd, but I'm not going to bother investigating.) A backslash will not work on OS X (as far as accessing files goes).
Feb 08 '11 at 08:15 PM
Eric5h5
Good to know, edited accordingly.
Feb 08 '11 at 09:33 PM
yoyo
(comments are locked)
|
|
An array of GUIContents won't work either, alas. You can replace " +1 for knowing it wouldn't work :-( ... but I can't give you credit for the right answer because I don't have that slash on my keyboard, and while I was able to convert my editor to UTF-8 and copy-paste into my code, the slash turns into an "a" with an accent over it when I drop the menu.
Feb 08 '11 at 04:58 PM
yoyo
This is what appears -- "". (Note that I'm on a Windows PC.)
Feb 08 '11 at 04:59 PM
yoyo
That's too bad; works fine on OS X, and it's standard Unicode, so I don't know what the problem would be.
Feb 08 '11 at 08:16 PM
Eric5h5
(comments are locked)
|

Ah, I can pass an array of GUIContents, doesn't have to be strings. I'll try that in the morning, pretty sure it will work.