- Home /
How to Change text of a Button or Input Field by clicking a button?
I have a combo box/drop down menu in the main menu of my game and I want the functionality of having the item the player selects show at the top of the un-opened menu. to tdo this I figured I'd use an Input field and change its contents using the onClick text.text function having it provide a string of the button that was pushed. No such luck. I've tried and no text shows up, and all the solutions I see are in C# making JS nearly impossible to use in problem solving. can anyone help here?
In the inspector, you'll notice that the button has child objects attached. One of those child objects is a game object with a Text component attached.
In your script, you'll need to get a reference to that text component and set its Text value.
Your answer
Follow this Question
Related Questions
DropDown menu(add item from input field): Object reference not set to instance of an object C# 1 Answer
Functions aren't appearing in the onClick editor..... 1 Answer
Extending Unity's UI components 1 Answer
How to understand if 4.6 UI button is highlighted? 3 Answers
Canvas Button persistence 0 Answers