- Home /
Question by
Shinobi_Lord · Mar 19, 2021 at 09:07 AM ·
controlleroptimizationbeginnerefficiencyinput manager
Can GetKey/GetKeyDown/GetKeyUp all return true in the same frame?
Like the title asks, am I right in believing that the functions GetKey/GetKeyDown/GetKeyUp cannot all return true in the same frame? As in only one can be true in any given frame?
And if so, would it be "efficient" to do something like :
if(GetKey)
...
return;
else if(GetKeyDown)
...
return;
else if(GetKeyUp)
...
return;
As there is no need to test for subsequent calls if the preceding one is true.
Thanks for any help and time, stay safe.
Comment
afaik GetKey and GetKeyDown can be true in the same frame, GetKeyUp however can not be true when either GetKey or GetKeyDown are true.
That's good enough for me. Thanks a lot for your help.