You can achieve this by following these steps,
main.cs196 chars11 lines
This code uses InvokeRepeating() to repeatedly call the PlayFartSound() method every 3 seconds after the initial delay of 1 second.
The PlayFartSound() method randomly selects a fart sound from the fartSounds array and plays it using the audioSource.PlayOneShot() method.
Make sure to assign the AudioSource component to the "FartPlayer" script's audioSource variable in the Unity Inspector.
Now, you should have a continuous random fart sounds playing in your game!
gistlibby LogSnag