aaron.frost
aaron.frost
CC#
Created by aaron.frost on 2/2/2023 in #help
❔ Console.ReadKey() blocking
Hey there. I have this function that is called every frame:
public void Update()
{
if ( !Console.KeyAvailable ) return;

var key = Console.ReadKey(intercept: true);
}
public void Update()
{
if ( !Console.KeyAvailable ) return;

var key = Console.ReadKey(intercept: true);
}
It blocks until a key is pressed instead of setting KeyAvailable back to false... I know this is being called every frame because I can insert a Debug.Log(); return; at the top and I will see it log every frame. However if I put the Debug.Log() after the ReadKey(), it only gets called when you press keys.
21 replies