Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

How to create a style sheet for the new UI?

Discussion in 'Unity UI (uGUI) & TextMesh Pro' started by adamz, Sep 29, 2015.

  1. adamz

    adamz

    Joined:
    Jul 18, 2007
    Posts:
    928
    Is there a way to create a "style sheet" for Unity 5's UI system? I want to be able to create all my UI, and then change it visually as well as the fonts in one place, thus automatically changing it everywhere.
     
  2. Senshi

    Senshi

    Joined:
    Oct 3, 2010
    Posts:
    525
    No, there is no built-in way to do this. I think the easiest way would be to create some simple images that you expect to need, like "panel_9slice", "button_9slice", "icon_background", etc. Then when you're done you can just overwrite the files and they will update everywhere, as they're still being referenced at the object level.

    Same for fonts, though you might want to change the names from something like "Arial" to "score_font" and the like, just to prevent confusion when you're overwriting it and suddenly have a Helvetica called Arial (though you can still rename the asset without worries; just make sure to do it one step at a time (i.e.: overwrite -> rename or rename -> overwrite)).

    If you want more programmatic control, you would need to roll your own solution.
     
  3. topaz7

    topaz7

    Joined:
    Dec 15, 2012
    Posts:
    76
    You might be interested on the Coherent UI.
     
  4. Kiwasi

    Kiwasi

    Joined:
    Dec 5, 2013
    Posts:
    16,477
    You can get some of this with prefabs. But its not entirely the same functionality as a style sheet
     
  5. adamz

    adamz

    Joined:
    Jul 18, 2007
    Posts:
    928
    Thanks everyone