- Home /
EditorGUILayout - dropdown / linked toggles & foldout+togglegroup combined
Hello all,
I am wondering if it's possible to create a dropdown menu much like the ones you have in the Shuriken particle system to change between constant values and curves. If not, is there a function to create "linked" toggle buttons or if you have to link them yourself? Like if you enable one of them, all the others are disabled.
Also, is it possible to combine a foldout and group toggle to create different ahm.."chapters". Again, look at the Shuriken. You can click on "Emission" for example to unfold the field, but you can also click the toggle to disabled the whole field. If it's possible, how?
EDIT:
ok I found EditorGUILayout.enumPopup, but when I use it I get an error: "Cannot implicitly convert type 'System.Enum' to 'MyClass.TimeUnit'.
TimeUnit is an enum in another script. I made a property called Unit in that script and I try to use it in my editorscript:
t.Unit = EditorGUILayout.EnumPopup("Time unit: ", t.Unit);
Why do I get this error?
As for my foldout/toggle problem..I just went with an if-statement to check if the value connected to the toggle was true.
Answer by CodeMasterMike · Nov 07, 2012 at 02:46 PM
You need to set (ClassName.TimeUnit) before the EnumPopup call. Something like this:
private t.TimeUnit timeUnitOptions;
timeUnitOptions = (t.TimeUnit)EditorGUILayout.EnumPopup("Time unit: ", timeUnitOptions);
Yes, I did try that, but it said 'the type or namespace 't' could not be found'.
Your answer
Follow this Question
Related Questions
Dropdown with list of buttons instead of toggles 1 Answer
EditorGUI.ObjectField placed right below EditorGUI.Foldout? 1 Answer
Dropdown with multiple active options/choices(toggles)? 0 Answers
Why isn't there an overload method for EditorGUILayout.Toggle to toggleOnLabelClick? 1 Answer
Gui dropdown select many items 0 Answers