UnityNinja Community
Would you like to react to this message? Create an account in a few clicks or log in to continue.

UnityNinja CommunityLog in

UnityNinja - Video Game Development Community, including Resources, Forums, Marketplace & More.


descriptionPlaying Audio script? EmptyPlaying Audio script?

more_horiz
Help me guys i need a script that replays a .mwv or mp3 audio file but waits a few seconds before the replay. Does any body knows how to make that possible?  Question 

descriptionPlaying Audio script? EmptyRe: Playing Audio script?

more_horiz
Try the following C# code:
using UnityEngine;
using System.Collections;

public class Audio : MonoBehaviour {

// Use this for initialization
void Start () {
StartCoroutine (PlayAudio ());

}

IEnumerator PlayAudio(){
while(true){
yield return new WaitForSeconds (3f);
audio.Play ();
}
}
}
privacy_tip Permissions in this forum:
You cannot reply to topics in this forum
power_settings_newLogin to reply