Search Unity

Question How to define sub-items for AddBehaviour menu?

Discussion in 'Editor & General Support' started by launemax, Dec 16, 2021.

  1. launemax

    launemax

    Joined:
    Feb 14, 2013
    Posts:
    17
    Hy community,

    I'm wondering, if and how I can set sub-entries in the AddBehaviour menu inside Animator inspector?
    On normal MonoBehaviours I can use AddComponentMenu() Attribute, but what's the equivalent for this for AddBehaviour menu?

    addbehaviour.png

    Thanks for your help.
     
  2. Rotary-Heart

    Rotary-Heart

    Joined:
    Dec 18, 2012
    Posts:
    813
  3. launemax

    launemax

    Joined:
    Feb 14, 2013
    Posts:
    17
    Does anybody have an idea about this?
     
  4. jamesbean

    jamesbean

    Joined:
    May 15, 2014
    Posts:
    3
    I was just looking for this on Unity 2022.2.0b16. Using `[AddComponentMenu()]` sets the custom name on the item, but doesn't set the menu path in the "Add Behaviour" menu. Which is not ideal, but it kind-of-works. Maybe this is just an editor thing that unity just needs to extend to the StateMachine inspector?

    upload_2022-11-23_21-17-56.png
    upload_2022-11-23_21-18-12.png