Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    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:
    49
    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. 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:
    49
    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.