how to see if they are aholding down a key unity
input.GetKey("Key")
how to see if they are aholding down a key unity
input.GetKey("Key")
how to check if key is held in unity
float startTime; // declare this outside any function
void Update () {
if (Input.Get$$anonymous$$eyDown("w")||Input.Get$$anonymous$$eyDown("s")){
// key pressed: save the current time
startTime = Time.time;
}
if (Input.Get$$anonymous$$eyUp("w")||Input.Get$$anonymous$$eyDown("s")){
// key released: measure the time
float timePressed = Time.time - startTime;
// do here whatever you want with timePressed
}
RandNum = Random.Range(1, 1000);
if (Input.Get$$anonymous$$eyDown($$anonymous$$eyCode.W) || Input.Get$$anonymous$$eyDown($$anonymous$$eyCode.S)){
if(RandNum > 1){
if(RandNum < 1000){
inBattle ();
}
}
}
}
how to check if key is held in unity
/*the other guys is right it is just*/
input.GetKey("Key") /*eg - Keycode.W/A/S/D*/
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us