|
Right now, I have a custom sound clip that has a longer duration than that of the standard clip that came with the machine gun in the FPS demo. How do I make it loop on top of itself or make it play at every firing? Right now it waits for the sound file to finish before starting the next one. Here's the section of the script. function LateUpdate() { if (muzzleFlash) { // We shot this frame, enable the muzzle flash if (m_LastFrameShot == Time.frameCount) { muzzleFlash.transform.localRotation = Quaternion.AngleAxis(Random.value * 360, Vector3.forward); muzzleFlash.enabled = true;
}
(comments are locked)
|
|
You can dynamically create and add a new audio source component and have it play the sound file and then once the sound finishes playing destroy that component.
(comments are locked)
|

Could you paste the portion of the code from the FPS demo which handles the firing? (haven't looked over it closely myself)