How do I detect player actions?

Hello there, I am beginner in Unity and I am creating a 2 player 2D game and I want my game to show an input field for player 1 if player 2 presses a button and vice versa. It’s not an online game. How do I go about this? Any help will be appreciated.

i wrote a script to control player turns.