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. Dismiss Notice

Question Showing the binded key image inside TextMeshPro text

Discussion in 'Input System' started by sayginkarahan, May 4, 2021.

  1. sayginkarahan

    sayginkarahan

    Joined:
    Jan 23, 2015
    Posts:
    43
    Hi, I'm working on implementing the new input system into my existing game project. I will try to explain my question. How can we get the user-changeable button image inside a TextMeshPro text using sprite asset? I can do that with static keys but I want to use the power of the new input system bind feature with TextMeshPro. Is there anyone who knows how to do that?

    Screenshot_2.png

    Thanks a lot.
     
    Last edited: May 4, 2021
  2. Lurking-Ninja

    Lurking-Ninja

    Joined:
    Jan 20, 2015
    Posts:
    9,826
    Check out the GetBindingDisplayString methods. You probably can use that to acquire the name of the control and then proceed to feed it to TextMesh converting it to some sort of icon.
     
    sayginkarahan likes this.
  3. sayginkarahan

    sayginkarahan

    Joined:
    Jan 23, 2015
    Posts:
    43
    Screenshot_1.png

    You're right! If I set the TextMeshPro Sprite Assets name according to binding names, I can use like that Press <sprite="NorthButton"> to Drop. Thanks.
     
    Lurking-Ninja likes this.