Search Unity

  1. Unity 2018.3 is now released.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. We've updated our Terms of Service. Please read our blog post from Unity CTO and Co-Founder Joachim Ante here
    Dismiss Notice
  4. Want to provide direct feedback to the Unity team? Join the Unity Advisory Panel.
    Dismiss Notice
  5. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice

Property drawer enum

Discussion in 'Extensions & OnGUI' started by MaskedMouse, Jul 22, 2018.

  1. MaskedMouse


    Jul 8, 2014
    I'm trying to re-create the property drawer that Ryan used in his talk Unite Austin 2017 with Scriptable Objects.

    So basically this is a sort of enum popup with a field behind the chosen enum.
    But if I do an EditorGUI.EnumPopup it will show up as a bar with the enum name in it instead of a menu dropdown kind of like thing as shown in the image below.
    How do I re-create this kind of menu dropdown?


    Edit: Ah right, found the solution apparently he had a github source up

    The specific thing I was looking for:
    Code (CSharp):
    1. popupStyle = new GUIStyle("PaneOptions"));
    2. popupStyle.imagePosition = ImagePosition.ImageOnly;
    Last edited: Jul 25, 2018
  2. Hosnkobf


    Aug 23, 2016
    To answer the actual question properly: Pass a different GUIStyle (and maybe also GUILayout.Width(x) as GUILayoutOption).