Search Unity

Select Font Dialog from Custom Inspector

Discussion in 'Immediate Mode GUI (IMGUI)' started by tango209, May 13, 2015.

  1. tango209

    tango209

    Joined:
    Feb 23, 2011
    Posts:
    379
    I did a bit of searching, but I can't find a way to add the built in Font inspector in my custom inspector. Can anyone point me in the right direction?

    Thanks
     
  2. BMayne

    BMayne

    Joined:
    Aug 4, 2014
    Posts:
    186
    Hey there,

    Are you talking about the font inspector below?

     
  3. tango209

    tango209

    Joined:
    Feb 23, 2011
    Posts:
    379
    That would be preferable, but at a minimum I need the Font control just under Character in your screenshot. That opens the Select Font dialog.
     
  4. BMayne

    BMayne

    Joined:
    Aug 4, 2014
    Posts:
    186
    It's super easy to do. Just make a public variable of type UnityEngine.UI.FontData. It has a property drawer that does the inspector you see above.
     
  5. tango209

    tango209

    Joined:
    Feb 23, 2011
    Posts:
    379
    The problem is when creating an EditorWindow all of the member variables are hidden and have to be exposed with calls such as EditorGUILayout.TextArea(...), etc. and there doesn't seem to be a corresponding method to expose Fonts.