Search Unity

  1. Dismiss Notice
  2. We are migrating the Unity Forums to Unity Discussions by the end of July. Read our announcement for more information and let us know if you have any questions.
    Dismiss Notice

Question How to change UI Theme

Discussion in 'Accessibility' started by cevozby, Feb 5, 2024.

  1. cevozby

    cevozby

    Joined:
    Jun 22, 2021
    Posts:
    39
    Hi everyone, I did research on this subject but could not get a clear result. Either someone hasn't posted an example on the internet or I couldn't research the right thing.

    The problem is that I want to change the UI theme in my game from the settings. I currently have two themes; Traditional and Dark. The game will start with Dark UI when starting, but I want you to be able to switch to the Traditional UI from the settings while in the game. Since it's a text-based game, there are a lot of panels or images.

    Is there a tool that I can use to handle this kind of mechanics or do you have any suggestions?

    Example images:
    DARK UI


    TRADITIONAL UI
     
  2. JuliaP_Unity

    JuliaP_Unity

    Unity Technologies

    Joined:
    Mar 26, 2020
    Posts:
    709
    Hello! Have you considered using UI Toolkit to make your UI? It uses style sheets so it's much easier to switch themes easily :)
     
  3. cevozby

    cevozby

    Joined:
    Jun 22, 2021
    Posts:
    39
    No, I didn't, I proceeded by creating an Image directly. Now I looked at it and said, "How have I not used this before?" :') But there is a problem, how long will it take to transfer the whole project to this? Because I'm planning to release this game soon, will it take me too long to change the entire UI? Is there any other way? I wish I had learned this before. :)
     
  4. JuliaP_Unity

    JuliaP_Unity

    Unity Technologies

    Joined:
    Mar 26, 2020
    Posts:
    709
    Well changing themes in uGUI (the main UI system currently) is not really a thing you get out of the box with Unity, you'd have to change assets/colors in many places manually. With UI Toolkit (available for Runtime UI since 2021.3) you do it through style sheets so the effort would be different - can't say if greater os less than though! Depends on many factors.
    I don't know your UI design, of course, but the ones you showed here would be pretty simple to replicate with UI Toolkit. I recommend exploring it a bit through using the UI Builder (Window > UI Toolkit > UI Builder) so you can have an idea!
     
    cevozby likes this.
  5. cevozby

    cevozby

    Joined:
    Jun 22, 2021
    Posts:
    39
    I will try this anyway, as there is no other solution for the problem I am looking for, other than doing it manually with my own hands. Thank you very much for your answer.
     
    JuliaP_Unity likes this.