Trying to repeat the function function OnAttack() continuously while a button is being held down.
Basically I’m looking for an equivalent to Update() { GetKeyDown() {//code }} But with the input system.
Trying to repeat the function function OnAttack() continuously while a button is being held down.
Basically I’m looking for an equivalent to Update() { GetKeyDown() {//code }} But with the input system.
Edit 2: Okay I solved it by using “press” in the interactions and giving that The trigger behaviour “Press and release”, then did
bool held = false;
Update() { if(held) {//animation} else if(!held) {//idle animation}
OnAttack() {held = !held; }
This way if I press the button held goes to true so it repeats the animation every frame, letting go makes “held” untrue and does the idle animation
Edit 2: Okay I solved it by using "press" in the interactions and giving that The trigger behaviour "Press and release", then did bool held = false; Update() { if(held) {//animation} else if(!held) {//idle animation} OnAttack() {held = !held; } This way if I press the button held goes to true so it repeats the animation every frame, letting go makes "held" untrue and does the idle animation
– Sabishi1