I want to be able to play a looped sound while I keep a key pressed:
if (Input.GetKey (KeyCode.Delete))
{
object.transform.Rotate(0, -15*Time.deltaTime, 0);
//play sound while object is rotated
audio.clip = mySound;
audio.Play();
Debug.Log("Play sound");
}
And I got the exact opposite of the desired effect. Sound is played only after I press and release the first time my key. On press again, it’s quiet. On release, it’s looping nicely. Also, I can’t use KeyDown (which makes the sound work properly) or it will nullify the transform of the object.