Search Unity

Overriding theme

Discussion in 'UI Toolkit' started by Kaiymu_, May 12, 2020.

  1. Kaiymu_

    Kaiymu_

    Joined:
    Jun 1, 2016
    Posts:
    47
    Hello everyone,

    Quick question, I wanted to know if they're any way to create our own theme or overriding them?

    On BuilderDocument.cs I can see that they're the 4 enums that you can access in UIBuilder

    Code (CSharp):
    1.         public enum CanvasTheme
    2.         {
    3.             Default,
    4.             Dark,
    5.             Light,
    6.             Runtime
    7.         }
    upload_2020-5-12_17-17-57.png

    Would they be any way to add my own custom theme?

    Basically, I want to implement a theme system, available at runtime and in editor (Meaning that when I switch to my theme, I also see the result in the UIBuilder page).

    I'm working with a team of UI guys, that are no concern whatsoever of the code part (https://docs.unity3d.com/2020.1/Doc...3.1511540736.1589201301-1108364202.1557781689)

    For exemple, I would implement like so
    - Create a GlobalUSS.uss file
    - Add 3 class, GlobalColorTheme, Theme2, Theme2
    - Applying only .GlobalColorTheme to my elements
    - And using custom properties override GlobalColorTheme with either Theme1/Theme 2, both at runtime and in editor.

    Would that be possible to do so? And if so, how would you manage that?
    Doing so would be great for us because we would only preset the system once, by adding the enums + creating the linked theme. Meaning that the UI theme (non-tech) would create their theme and see them running while I would have setupped the system only!

    Thank you everyone :)