I believe I got it in how he explained. I still have that glitchy sound when I press on my space bar AND sometimes when I release the key the sound continues. Any ideas from looking at the code?
private void Rotate()
{
if (Input.GetKey(KeyCode.A)) // Turn left
{
transform.Rotate(Vector3.forward);
}
else if (Input.GetKey(KeyCode.D)) // Turn right
{
transform.Rotate(-Vector3.forward);
}
}
private void Thrust()
{
if (Input.GetKey(KeyCode.Space)) // You can thrust while rotating.
{
rigidBody.AddRelativeForce(Vector3.up);
if (!audioSource.isPlaying)
{
audioSource.Play();
}
else
{
audioSource.Stop();
}
}
}