Hi,
I was running some code from an older project in 2018.2 when I noticed something with the input logic that has stopped working. Basically I toggle some debug UI overlay based on the user / developer pressing CTRL+F but that has stopped working. To verify my logic I wrote this simple test script (in a MonoBehaviour Update function):
bool controlHeld = (Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl));
bool toggleKeyHeld = Input.GetKey(KeyCode.F);
Debug.Log("CTRL = " + (controlHeld ? "TRUE" : "FALSE") + " ,F = " + (toggleKeyHeld ? "TRUE" : "FALSE"));
When I test it I get the following result (just using the left control button to limit the complexity):
When I do not hold down anything: CTRL = FALSE ,F = FALSE
When I hold down Control only: CTRL = TRUE ,F = FALSE
When I hold down F only: CTRL = FALSE ,F = TRUE
When I hold down Control first and then hold down F as well: CTRL = TRUE, F = FALSE
When I hold down F first and then hold down Control as well: CTRL = TRUE ,F = TRUE
Based on these results it seems that holding down CTRL changes the keycode that the game receives, so it no longer receives Input.GetKey(KeyCode.F) as true. Is this intended behaviour? If so, what is the correct/better way to do this (this is just for debug functionality)?
Cheers,
Ron