GetKeyDown, registers ONCE when the user actually presses the key stroke, doesnt have to lift their finger off the key, just as soon as the computer registers “Left Control was pressed”, it considers it down, it doesnt check “Left Control is still down” – thats what GetKey does, itll continue to send “Left Control is held down” rather then “Left Control is pressed”.
So you could try structuring your if-statements to look like:
if (Input.GetKey(KeyCode.LeftControl) && Input.GetButtonDown("Fire1"))
{
anim.SetTrigger("LeftPowerAttack");
}
else if (Input.GetButtonDown("Fire1"))
{
anim.SetTrigger("LeftAttack");
}
else if (Input.GetButtonDown("Fire2"))
{
anim.SetTrigger("RightAttack");
}
Based on that code, the LeftPowerAttack should be happening. I haven’t messed around with checking two inputs within a single if statement, but as I said, that should be working. Two options for improvement immediately come to mind: 1. You could nest the check for leftcontrol, so like
if (Input.GetButtonDown("Fire1"))
{
if(Input.GetKeyDown(KeyCode.LeftControl)){
anim.SetTrigger("LeftPowerAttack");
}
else{
anim.SetTrigger("LeftAttack");
}
should work.
You could have Left control be stored in a different boolean variable and have it check that instead of the actual GetKeyDown.
I also just noticed that you’re using GetButtonDown for fire1, which would work if you have it set up as a button. As far as I am aware, though, “fire1” is defaultly an Axis, which means that you would measure it as a float with a range from -1 to 1. You would check this by typing if(Input.GetAxis(“fire1” > 0f))
You can go into Edit > Project Settings > Input to change whether or not it is an Axis