Hi, I’m trying to get my spaceships thrusters to have a thruster sound play when a certain key is held down.
This script works but it plays the sound “thrust” over and over when I hold down the key:
void Update () {
if(Input.GetKey(KeyCode.S) || Input.GetKey(KeyCode.D))
{
audioSource.enabled = true;
thisParticleRenderer.enabled = true;
audio.PlayOneShot(thrust);
I know its because its under void update (although I thought PlayOneShot meant play once) but how do I get the sound to play when “S” or “D” is held down and loop but not play over itself on over and over? I hope that made sense any help is greatly appreciated.