Display button prompts with sprites in TextMesh Pro

Uploaded by Christina Creates Games
Share: Twitter Facebook
You can display button prompts (or just buttons to press) as sprites inside your TextMesh Pro text boxes with just a bit of initial setup. You'll see how to do it by hardcoding them in as well as in Unity's new input system, where bindings might change at some point.

For how to use the new input system, I highly recommend PitiIT's or Samyam's tutorials on the topic.
PitiIT https://www.youtube.com/watch?v=-0Cl54_3lmM
Samyam https://www.youtube.com/watch?v=m5WsmlEOFiA&list=PLKUARkaoYQT2nKuWy0mKwYURe2roBGJdr

Xelu's free controller prompts: https://thoseawesomeguys.com/prompts/
Sprite Sheet generator: https://codeshack.io/images-sprite-sheet-generator/


Interesting docs for the new input system you might be interested in:
Here are a few pointers of where to look for more info on how to get a string from your binding and/or how to get which input device type is currently active:
This for getting a binding
https://docs.unity3d.com/Packages/com.unity.inputsystem@1.4/manual/ActionBindings.html#displaying-bindings
And here's one for getting the Binding Index by using a binding mask
https://docs.unity3d.com/Packages/com.unity.inputsystem@1.4/api/UnityEngine.InputSystem.InputActionRebindingExtensions.html#UnityEngine_InputSystem_InputActionRebindingExtensions_GetBindingIndex_UnityEngine_InputSystem_InputAction_UnityEngine_InputSystem_InputBinding_

Here's the documentation on getting the current control scheme (though I have read that it doesn't work if you generate your C# script and my tests seemed to agree with that statement)
https://docs.unity3d.com/Packages/com.unity.inputsystem@1.1/api/UnityEngine.InputSystem.PlayerInput.html#UnityEngine_InputSystem_PlayerInput_currentControlScheme
I have come across tutorials that mentioned saving the currently active input device to a value when input devices changes, though it has been a while and I can't seem to find my links anymore. Basically, they used this: https://docs.unity3d.com/Packages/com.unity.inputsystem@1.4/api/UnityEngine.InputSystem.InputDeviceChange.html


If anybody knows of a great, applies-to-every-way-of-implementation kind of way, I would super appreciate to get to know about it =)!

-- Chapters --
00:00 What we will be creating
00:19 Prerequisits
00:33 Get free, amazing quality button sprites from ThoseAwesomeGuys
01:28 Quickly pack single sprites into a sprite sheet via tool
01:41 Setup your sprites
02:19 Hardcoding in your button prompt
02:39 The new input system's customizable bindings
03:01 Initial setup
03:16 Overview of the scripts
04:20 The text setter script
05:46 The replacer script
07:19 Using the replacer
08:38 Renaming Button Sprites
09:00 Setup the component

#unitytutorial