I'm writing a C# player script for a class and when I run, the sound inputs work fine, but the movement inputs don't respond, and I don't know how to fix it.
Code:
Rigidbody rigidbody;
AudioSource audioSource;
void Start(){
rigidbody = GetComponent<Rigidbody>();
audioSource = GetComponent<AudioSource>();
}
void Update(){
ProcessInputs();
}
private void ProcessInputs()
{
if (Input.GetKey(KeyCode.Space))
{
rigidbody.AddRelativeForce(Vector3.up);
if (!audioSource.isPlaying)
{
audioSource.Play();
}
}
else
{
audioSource.Stop();
}
if (Input.GetKey(KeyCode.A))
{
transform.Rotate(Vector3.forward);
}
if (Input.GetKey(KeyCode.D))
{
transform.Rotate(-Vector3.forward);
}
}