Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Display Input.(Get)Button as a string message

Discussion in 'Scripting' started by ApocFI, Sep 24, 2018.

  1. ApocFI

    ApocFI

    Joined:
    May 26, 2017
    Posts:
    33
    I looked through Unity input API but didn't find an answer to this:

    How do you display a string message of a user-set key?

    example: I've created an Input.GetButton("Reload") in the input settings. Now I want a message which is displayed at certain points in the game.
    Debug.Log ("Press " +(*showMeTheButton*("Reload") + " to reload");

    It must be somewhere in the input API as this is quite simple thing, maybe I'm just blind... :D
     
    Last edited: Sep 24, 2018
  2. xVergilx

    xVergilx

    Joined:
    Dec 22, 2014
    Posts:
    3,296
    You can't, not without either new Input System, or any other custom implementation of input manager.

    I suggest using Custom Input Manager https://github.com/daemon3000/InputManager

    It's free and easy to setup. That way you can obtain primary / secondary / alt primary and alt secondary with it.
     
  3. ApocFI

    ApocFI

    Joined:
    May 26, 2017
    Posts:
    33
    Really? I'm surprised, I thought it wouldn't be so complicated thing to do. Well, I think I'll try your suggestion as it seems like a solid solution. Thanks.