Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Voting for the Unity Awards are OPEN! We’re looking to celebrate creators across games, industry, film, and many more categories. Cast your vote now for all categories
    Dismiss Notice
  3. 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,292
    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.