Unity highlight text instead of button

Objective: Allow the highlight of text on a button instead of the button image

You’re making a menu in a game and you want the text to be highlighted instead of the button image? Well, you’ve come to the right place and it will not take long to fix this.

Whenever you create a button in Unity whether regular or TMPro, you will always get an image attached to the button. Now, you could replace the image with one of your own and move on, but that takes time to create the images that you want to use. I’m going to show you how to make it so that the highlighting is searching for the text object instead of the image.

First create the button in your canvas and then look under the button component. You will see an option for a target graphic.

Then what you need to do is open up the child object of the button, which should be the Text object and drag that object into the target graphic section and change the alpha channel of the image component as well.

And that’s it for changing the highlighted object to the text component.

If you found this helpful, don’t forget to clap and follow for more articles on game development in Unity.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store