Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Global Theme Styler & Customizer

Discussion in 'Assets and Asset Store' started by Deleted User, May 20, 2018.

  1. Deleted User

    Deleted User

    Guest

    This is a lightweight theme tool to quickly customize all UI fonts, colors, and sprites with the click of a button.

    Docs

    ⚡︎ Start from one of the preset themes
    ⚡︎ Tailor your own theme to fit your project
    ⚡︎ Create custom theme parameters
    ⚡︎ 17 preset themes

    Version 1.0 coming soon. What would you like to see in an asset like this?

     
    DrOcto and Mark_01 like this.
  2. Deleted User

    Deleted User

    Guest

  3. adammmckee

    adammmckee

    Joined:
    Jul 15, 2012
    Posts:
    1
    Hi there!

    Just bought your tool, and it works great!

    Is there a way to switch themes at runtime? I'd like to give my users the ability to change themes.

    Best,
    Adam
     
  4. Deleted User

    Deleted User

    Guest

    Apologies for the delay. I have been out of country. Let me look into this, I'll get back with you later today.
     
  5. Deleted User

    Deleted User

    Guest

    I just updated the docs with information about this. Check it out, and let me know if it helps. Asset store updates can take a while, so this feature is not currently implemented.

    Basically, there are two things you need to do. Create a new script called ThemeManager and fill it with the contents below:

    Code (CSharp):
    1. using System.Collections.Generic;
    2. using UnityEngine;
    3.  
    4. namespace AlphaTemplates {
    5.     namespace Tools {
    6.         namespace Theme {
    7.  
    8.             public class ThemeManager : MonoBehaviour {
    9.  
    10.                 /// <summary>
    11.                 /// Get the names of the assets from the themes save location..
    12.                 /// ..and populate the name array to return
    13.                 ///
    14.                 /// Returns null if assets are not found, or assets are not in the correct location
    15.                 /// </summary>
    16.                 private string[] GetThemeNames()
    17.                 {
    18.                     string[] ret = null;
    19.  
    20.                     //try to find existing data
    21.                     Object[] saveResources = Resources.LoadAll(Const.THEMES_SAVE_LOC);
    22.  
    23.                     //create a string array according to data
    24.                     if (saveResources != null) {
    25.                         ret = new string[saveResources.Length];
    26.                     }
    27.                     else
    28.                     {
    29.                         return null;
    30.                     }
    31.  
    32.                     //populate the string array with data names
    33.                     for (int i = 0; i < saveResources.Length; i++) {
    34.                         ret[i] = saveResources[i].name;
    35.                     }
    36.  
    37.                     return ret;
    38.                 }
    39.  
    40.                 /// <summary>
    41.                 /// Loop through themes by modifying player prefs via arrow key presses
    42.                 /// </summary>
    43.                 private void Update()
    44.                 {
    45.                     if (Input.GetKeyDown(KeyCode.RightArrow))
    46.                     {
    47.                         m_currentIndex ++;
    48.                         if (m_currentIndex > themeNames.Length - 1)
    49.                         {
    50.                             m_currentIndex = 0;
    51.                         }
    52.                     }
    53.  
    54.                     if (Input.GetKeyDown(KeyCode.LeftArrow))
    55.                     {
    56.                         m_currentIndex --;
    57.                         if (m_currentIndex < 0)
    58.                         {
    59.                             m_currentIndex = themeNames.Length - 1;
    60.                         }
    61.                     }
    62.  
    63.                     if (themeNames != null)
    64.                     {
    65.                         PlayerPrefs.SetString(Const.THEMES_SAVE_NAME, themeNames[m_currentIndex]);
    66.                     }
    67.                 }
    68.  
    69.                 private void Start()
    70.                 {
    71.                     themeNames = GetThemeNames();
    72.                 }
    73.  
    74.                 private int m_currentIndex = 0;
    75.                 private string[] themeNames;
    76.             }
    77.         }
    78.     }
    79. }
    The code shows you how to get all of your theme asset names and load them individually.
    Place this component somewhere in your scene (once).

    Then, in the ThemeItem.cs component, add an Update method as follows:

    Code (CSharp):
    1. // new
    2.                 void Update()
    3.                 {
    4.                     ReloadTheme();
    5.                 }
     
  6. Deleted User

    Deleted User

    Guest

    The new Theme Manager has been included in the latest update (1.1). With this, you can hotswap themes at runtime, in case you wanted to sell themes as an addon to your games, or simply allow users to change the aesthetic of your app in settings.
     
  7. hmathias13

    hmathias13

    Joined:
    Jan 21, 2020
    Posts:
    1
    Hi,

    Does anyone knows if this plugin is compatible with HDRP?
     
  8. cdr9042

    cdr9042

    Joined:
    Apr 22, 2018
    Posts:
    163
    The link does not lead to the asset anymore, any updated link?
     
  9. oluwaseyeayinla

    oluwaseyeayinla

    Joined:
    Mar 22, 2016
    Posts:
    3
    cdr9042 likes this.
  10. bendogami

    bendogami

    Joined:
    Feb 8, 2023
    Posts:
    3
    Hi,

    do you plan any update for TextMeshPro ?