Check if text field is active


I am working on a scene where a key pad enters numbers into different text fields as the player clicks in and out of them. For example, the player will click into the first text field and then click a button for a corresponding number and the number is then entered into that text field. Below is the editor for the scene thus far. I only have a couple buttons and couple text fields.

The issue I am running to is that when I click on one text field and then click a button ALL of the text fields then become populated with number of the button. Right now it is being handled with individual scripts for each button and text field but I am thinking I may also use a parent script that handles all events which would be attached to the 2D screen??

A first helpful step maybe to determine which text field is active, i.e. the text cursor is currently blinking within it. How can I do this first?

Checking a field if it’s active has been answered here: [SOLVED] How to detect if input field is active?

1 Like

Thanks @Leonidas ! This is basically an older post of the one you linked to.

1 Like