- Home /
Question by
deltron1830 · Nov 05, 2014 at 01:24 PM ·
editormenu
Custom menu dissapearing sometimes.
heres what the menu for adding components in my asset looks like most of the time..
In a folder called 'Editor' I have a script which implements the menu like so..
[MenuItem ("Component/Liquid Physics 2D/Collider/Box")]
static void AddaBox()
{
if (Selection.activeGameObject != null)
{
Undo.AddComponent<LPFixtureBox>(Selection.activeGameObject);
}
else
{
Debug.LogError("No gameobject selected");
}
}
[MenuItem ("Component/Liquid Physics 2D/Collider/Polygon")]
static void AddaPoly()
{
if (Selection.activeGameObject != null)
{
Undo.AddComponent<LPFixturePoly>(Selection.activeGameObject);
}
else
{
Debug.LogError("No gameobject selected");
}
}
Those are just 2 examples, for every component you can add there is another function but they are all essentially identical to the examples.
My problem is.. For no apparent reason, occasionally, my custom menu 'Liquid Physics 2D' will dissapear altogether from the component menu as an option. Restarting the editor will bring it back but it is quite annoying and I'm wondering if I am doing something wrong or if others have encountered this.
menu.png
(185.0 kB)
Comment
Your answer

Follow this Question
Related Questions
Making a Selectable EditorGUI Menu 0 Answers
Editor Scripting Question 1 Answer
creating a menu 1 Answer
Editor menus are invisible 1 Answer