Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice
  2. Ever participated in one our Game Jams? Want pointers on your project? Our Evangelists will be available on Friday to give feedback. Come share your games with us!
    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:
    2,259
    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.
     
unityunity