edited May 2016 in ORK Support
I'm making a series of interaction HUD's that say open/enter/talk etc. when a player enters an interaction trigger (using ORK, like in the tutorial) and I'm using the Rewired asset to handle custom controls. There's a simple function with Rewired to make something happen depending on whether you press a controller button or keyboard button. I intend to show a keyboard button image or xbox button image depending on what the player last used.

My questions:

1.)
How do you add an image after the text of an interaction HUD i.e. ENTER [z button image] or TALK [xbox A button image]

2.) how would I access that image via script so I can switch it out using my Rewired functions?

also if anyone has a simpler method for adding images that represent buttons let me know. Thank you!
Post edited by braytendo on
  • 1) You can either use a HUD element to add an image, or use text codes to add icons from already set up data (e.g. scene objects in World > Scene Objects) or select an icon from a Resources folder in Unity.

    2) That depends on what UI system you're using (legacy GUI or new UI), but is in both cases very complex and may not be possible.

    It'd be easier to use the variable conditions for HUDs to display a different HUD based on game variables.
    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!
  • oooooh, and I could access those game variables to change via my script! Much better solution, thanks! :D
  • edited May 2016
    So I ran into a bit of an issue. I made an interaction HUD for gamepad and one for controller that both display on any interaction and added a single game variable to both, named gamepad and keyboard respectively, that need to be bool true in order for the HUD to show up.

    Then in my script, if a keyboard was last used it sets ORK.Game.Variables.Set("keyboard", true) and ORK.Game.Variables.Set("gamepad", false) and if a gamepad was last used, it sets the opposite.

    I added a debug log to make sure the variables were being changed, and they are, but the interaction HUD never shows up when I enter a trigger.

    The interaction HUD works fine if I remove the required game variables, so I know it's set up correctly. Any idea what I might be doing wrong?

    EDIT: wait, I think I understand now. Setting the value type to game variable means that the name of the variable will be whatever that game variable returns so long as that variable is a string. That's extremely confusing....but yeah, setting value type to value made it work.
    Post edited by braytendo on
  • Try reducing it to a simple Bool in a global variable.
    True = Keyboard, False = Gamepad
    Not sure if that'll solve it but it might make things clearer since there are now only 2 possible states.
  • Yeah, the Game Variable value type uses the value stored in the defined string variable as the variable key. Might be a bit confusing at first, but it allows doing cool and complex stuff, e.g. having a HUD's display requirement change in-game or using a formula or event to calculate stuff based on different variables depending on what was stored as keys before.
    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.