Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

How to ignore other keypress events when player is editing text inputfield

Discussion in 'UIElements' started by TheCrake, Aug 7, 2019.

  1. TheCrake

    TheCrake

    Joined:
    Oct 24, 2018
    Posts:
    12
    I have an inputfield where the player can enter numbers. I also use the number keys to activate certain actions. I want to allow the player to type 1, 2, or 3 for example into the input field without it activating the actions normally triggered by pressing 1, 2 or 3 in the main game. I've found a way to detect when the player exits the inputfield, but I cannot find any way to detect when you either start editing or when it is focused. It seems there were some abilities to detect that but they were removed from unity a long time ago. Anyone know the most elegant way to do this? Thanks so much!
     
  2. TheCrake

    TheCrake

    Joined:
    Oct 24, 2018
    Posts:
    12