- Home /
MenuItem in EditorWindow
Hi, i created two simple drop-down menu in unity editor.
http://gyazo.com/f2bb5c6a3657122de322ef805134b05a
For "Something1" here's the code:
[MenuItem("Tools/Something1")]
private static void showManipulator(){
EditorWindow.GetWindow<ScriptClassName>(false, "Something1");
}
"Something1" and "Something2" are in two separate scripts. So for now when i click "Something1" in unity editor a window appears, which is okay. But when i try to apply the same piece of code, but for "Something2" (in other script) the unity quits and crashes.
"Something2" code:
[MenuItem("Tools/Something2")]
private static void showOther(){
EditorWindow.GetWindow<ScriptClassNameOtherScript>(false, "Something2"); // if i comment this line out, there is no crash, just "Something2" drop menu
}
So why is it crashing, shouldn't it create a pop up editor window just like for "Something1" ?
-Thanks
$$anonymous$$aybe i am drawing the window incorectly, any comments, suggestions ?
Your answer made me double check script names, i had a gap between two words, which should be together, what a stupid mistake, thank you.
Convert your comment as answer, I'll tick it as answered.
Answer by ArkaneX · Sep 16, 2013 at 02:44 PM
Are you sure that your second script is named exactly ScriptClassNameOtherScript? Crash could be a result of different name.
Your answer
Follow this Question
Related Questions
How to add a menu item to the window's right side pop-up? 1 Answer
Editor Menu Item open Window 2 Answers
Make a pop up panel asking if I am sure I want to buy a specific item 0 Answers
Editor Scripting Question 1 Answer
How do I repaint/refresh/focus without calling Key Events multiple times? 1 Answer