So it's been like two years, but I'm finally tackling button mapping. I didn't want to, but apparently it's very important to a lot of gamers and can even mean the difference of a thumbs up or thumbs down review.

So the question: How do I deal with the icons? I'm using Rewired to take care of the actual button switching (that's the easy part), but I use Ork Framework for all my HUDs and GUI icons related to those buttons. I had discussed implementing icons as variables with GIL a long while back but, although the price was fair, it was sadly too expensive for me.

So has anyone else tried to tackle this? There has to be some way to access a sprite/icon in ORK for all events and interaction HUDs that can be updated/changed when I remap a button. Perhaps there's some way to update the source of the image itself within Unity?

This is too crucial a thing for me to just skip over if I don't want bad reviews, so any help is extremely appreciated!
  • Since all data in ORK is accessible, you can simply swap out the icon/texture of settings in-game via a custom script.

    You'd just have to know which stuff to access, e.g. you can get the settings of a HUD via ORK.HUDs.Get(id) (where id is the ID/index of the HUD).
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • I just thought of another, easier way to do this (due to another topic here).

    Hm, I haven't tested it, but you should be able to do this via resources icon text codes. E.g. if your icon is named Armor01, the text code would be #resources.iconArmor01#.
    Put that into a string variable and use the variable to add the icon to your text - if you need to swap out the icons, just change the text code in the variable.

    For this to work, you need to have the icons in a Resources folder in your project.
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • edited December 2019
    Oh! So then I could have a global string variable like "InputButton1" and set the string to a value of #resources.iconXboxA# or #resources.iconKeyboardZ# and just update that string value in whatever script I have for button mapping. Did I get that right?

    And then would this be the correct way to add the variable to a text box?

    image

    I assume the value of the variable would be displayed instead, and since the value is also a text code, it would then be replaced with the icon? Can text codes be layered like that?
    Post edited by braytendo on
  • Yes, that setup would be correct :)

    You can also create the resource icon text codes to store in the variables via the Icon button above the text area for copy/pasting, e.g. adding size overrides to have them at the same size.

    Game variables are one of the first things that are replaced, before all the data text codes. Also, icon text codes (as well as any layout text codes, e.g. font size, etc.) are used last, when the text is actually processed for displaying, so the variable text will be already an icon text code at that time.
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • Thank you so much! Man, every time I think I've hit a wall in Ork, you come up with a solution! Once I've made a good button mapping setup with the info above, I'll be sure to post a tutorial in the forum for anyone else in need. :D
  • Yeah ... sometimes I'm also amazed at what's possible :D
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
Sign In or Register to comment.