Search Unity

Managing UI Button / KB Key Icon Assets?

Discussion in 'UGUI & TextMesh Pro' started by Haapavuo, Dec 29, 2019.

  1. Haapavuo

    Haapavuo

    Joined:
    Sep 19, 2015
    Posts:
    97
    Hi,

    I am currently considering to use Scriptable Objects to manage UI Button Icons (such as X / Y / A / B, Cross / Circle / Square / Triangle, Keyboard keys etc). Creating those Scriptable Objects for each keyboard key is going to be a pain in the butt.

    Is there any other decent way to manage the sprite assets? Perhaps I should just load the assets from Resources?

    I am going to support multiple different input methods and want to show the corresponding key / button on UI when needed, and the player can also reconfigure the keys.

    EDIT: I am using Rewired for managing the player input.
     
  2. Haapavuo

    Haapavuo

    Joined:
    Sep 19, 2015
    Posts:
    97
    Bump. Anyone have any suggestions?
     
  3. eses

    eses

    Joined:
    Feb 26, 2013
    Posts:
    2,637
    @Haapavuo

    If you have more than just several (like all keyboard keys) icon images to manage, you could automate Scriptable Object and Asset file creation to Asset database.

    Either create an editor script or context menu method to run your Editor code.

    This way you can avoid creating Scriptable Objects manually (create asset file, assign texture etc.) if that is the problem.
     
    Haapavuo likes this.
  4. Haapavuo

    Haapavuo

    Joined:
    Sep 19, 2015
    Posts:
    97
    That could be one way for sure.

    Currently I am thinking of making a TextMeshPro Font of the button key icons and then use those button maps regarding of the current input method... Still not yet decided which way to go, though.