Stoping players from pressing keys.

I am making a turn based game. Is there a way to prevent players from pressing keys? I am testing for keypresses in update. what do I need to write at the end of update to block keypresses for some time ( 0.5 seconds).

set a float to record Time.time. Then before checking the keys see if Time.time > lastPressed +.5f.

That’s with lastPressed being the float.

So whenever a key is pressed.

lastPressed = Time.time;

And before you check for keys being pressed

if (Time.time > lastPressed + 0.5f)
{
// check for keys pressed here
}

set lastPressed = 0; in Start() so it doesn’t throw any errors.

any sort of if with a timer will work.
wrap all your keychecks into the if statement so if it fails they won’t even be checked.

for example I have a bool inventoryWindowOpen.

if (!inventoryWindowOpen) {
    //check for pickaxe hits on the mining wall
}

that way it won’t try to mine on the wall while the inventory is open.
same thing with keys, and in your case you just need a timer like Mmmpies points out.