Search Unity

Change GraphView font to Inter-Regular

Discussion in 'UI Toolkit' started by D4rt, Nov 13, 2019.

  1. D4rt

    D4rt

    Joined:
    Apr 20, 2013
    Posts:
    8
    I'm working on a custom graph editor using the GraphView visual element. The GraphView uses the old Unity editor fonts but I'd like to change it to use the new built-in Inter font.

    Is there a way to load the the font using USS and apply it to all child elements of the GraphView?
     
  2. D4rt

    D4rt

    Joined:
    Apr 20, 2013
    Posts:
    8
    Figured it out.

    To those interested, you can find the font paths used by the editor by going to the install folder and opening the file "Editor/Data/Resources/unity editor resources" in a text editor. Don't overwrite it, but you can search for the string ".ttf" and find all the fonts used by the editor. The path to the Inter font is "Fonts/Inter/Inter-Regular.ttf".

    In .uss you just use a selector to select all the children of the graph view:

    Code (USS):
    1. MyGraphView * {
    2.     -unity-font: resource("Fonts/Inter/Inter-Regular.ttf");
    3. }