Checking if the player is pressing two buttons at once

Hey all! I have a little problem with my script. I know exactly where it is so I won’t paste my whole script in here. Basically in my game I want to only have my character move in 8 directions using wasd. I’m trying to do this with if functions for every direction. My problem is that I cannot just do a simple and for two keys being pressed and I’m not sure of any other way to do it. Any help is appreciated.

An example of one of these in action:

if (Input.GetKey (KeyCode.W || KeyCode.A)) {
transform.rotation = Quaternion.Euler (theRigidbody.rotation.y, 315, theRigidbody.rotation.z);
theRigidbody.velocity = new Vector3 (-moveSpeed, 0, moveSpeed);
theAnimator.SetBool (“Idle”, false);
theAnimator.SetBool (“Walking”, true);
}

This way of doing things gives me 16 errors. I’m pretty sure it would all be fixed just by changing this one thing. An example of an error: Assets/PlayerController.cs(26,43): error CS0019: Operator ||' cannot be applied to operands of type UnityEngine.KeyCode’ and `UnityEngine.KeyCode’

Thanks again if you can come up with a different way to do things.

Update: I got it to work without giving any errors by using nested if functions like this…

if (Input.GetKey (KeyCode.W)) {
if (Input.GetKey (KeyCode.A)) {
theRigidbody.velocity = new Vector3 (-moveSpeed, 0, moveSpeed);
transform.rotation = Quaternion.Euler (theRigidbody.rotation.x, 315, theRigidbody.rotation.z);
theAnimator.SetBool (“Idle”, false);
theAnimator.SetBool (“Walking”, true);
}
}

But there is still a problem. My character only does this turned to south west. So what I listed above actually does nothing. I have no idea why.

Here’s the south west facing part of it:

if (Input.GetKey (KeyCode.S)) {
if (Input.GetKey (KeyCode.A)) {
theRigidbody.velocity = new Vector3 (-moveSpeed, 0, -moveSpeed);
transform.rotation = Quaternion.Euler (theRigidbody.rotation.x, 225, theRigidbody.rotation.z);
theAnimator.SetBool (“Idle”, false);
theAnimator.SetBool (“Walking”, true);
}
}

Thanks!