Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

EditorGUILayout popup menu item

Discussion in 'Editor & General Support' started by longvk1989, Sep 17, 2016.

  1. longvk1989

    longvk1989

    Joined:
    Apr 10, 2015
    Posts:
    17
    i want to make a dropdown menu item like UnityEvent since EditorGUILayout.Popup only take string array. Can anyone help me?

     
    Last edited: Sep 17, 2016
  2. zombiegorilla

    zombiegorilla

    Moderator

    Joined:
    May 8, 2012
    Posts:
    9,042
  3. longvk1989

    longvk1989

    Joined:
    Apr 10, 2015
    Posts:
    17
  4. zombiegorilla

    zombiegorilla

    Moderator

    Joined:
    May 8, 2012
    Posts:
    9,042
    Do you mean submenus?
     
  5. longvk1989

    longvk1989

    Joined:
    Apr 10, 2015
    Posts:
    17
    yes it is, look at the picture, it show sub menu like that
     
  6. longvk1989

    longvk1989

    Joined:
    Apr 10, 2015
    Posts:
    17
    i figure it out. Just put string array like {"menu1/item1", "menu1/item2", "menu1/item3", "menu2/item1", "menu2/item2"} in EditorGUILayout.Popup will do the trick!
     
  7. zombiegorilla

    zombiegorilla

    Moderator

    Joined:
    May 8, 2012
    Posts:
    9,042
    Yup, slashes. You can use them anywhere in the editor to create submenus.