Is it possible to create submenus in the "Component Browser" in Editor ?

Hello,

I have created an Unity3D plugin with the following namespace structure :

  • MyPlugin.Datas
  • MyPlugin.Scripts
  • MyPlugin.Scripts.Behaviours
  • MyPlugin.Scripts.Behaviours.[…]
  • MyPlugin.Scripts.Behaviours.[…].[…]
  • […]

When the DLL is imported in Unity Editor, the “Component Browser” (displayed by clicking the “Add Component” button in the Inspector) shows me my scripts like this :

  • Components > Scripts > MyPlugin.Scripts
  • Components > Scripts > MyPlugin.Scripts.Behaviours
  • Components > Scripts > MyPlugin.Scripts.[…]
  • Components > Scripts > MyPlugin.Scripts.[…].[…]

Is it possible to modify this “Component Browser” behaviour so it can display my scripts like this ?

  • Components > Scripts > MyPlugin > Scripts
  • Components > Scripts > MyPlugin > Scripts > Behaviours
  • Components > Scripts > MyPlugin > Scripts > Behaviours > […]
  • Components > Scripts > MyPlugin > Scripts > Behaviours > […] > […]

Thanks !

Use the AddComponentMenu attribute:

[AddComponentMenu( "My Scripts/Are/Now/Nested" )]
public class MyClass : MonoBehaviour {