Unity Ninja Unity 3D Forum
To have exclusive access to all downloads, recourses and links within this forum, a free registered account is required. Just a heads up Wink

You are not connected. Please login or register

Unity Ninja Unity 3D Forum » HELP » Help (General) » Playing Audio script?

Playing Audio script?

View previous topic View next topic Go down  Message [Page 1 of 1]

1 Playing Audio script? on Sun Jun 08, 2014 8:18 am

Survivor


{SUPER MEMBER}-LV.4
{SUPER MEMBER}-LV.4
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 

View user profile

2 Re: Playing Audio script? on Wed Aug 13, 2014 2:07 pm

Ninjaboy follower


Member [Lv. 3]
Member [Lv. 3]
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 ();
}
}
}

View user profile

View previous topic View next topic Back to top  Message [Page 1 of 1]

Permissions in this forum:
You cannot reply to topics in this forum