Quantcast
Channel: Questions in topic: "endless"
Viewing all articles
Browse latest Browse all 123

How do I make the track endlessly loop after reaching a certain length in the track?

$
0
0
How do I make the track endlessly loop after reaching a certain length in the track? (StartClip has the lengths I'm trying to get to loop in the code below.) Here's the code: using UnityEngine; using System.Collections; public class PlayLengthLoop : MonoBehaviour { public AudioClip audioClip; void Start() { //Add your own times here ! StartClip(34.900f,53.300f); } void StartClip(float timeStart, float timeEnd) { audio.clip = audioClip; audio.time = timeStart; audio.Play(); StartCoroutine(DelaySoundStop(timeEnd)); } IEnumerator DelaySoundStop(float timeEnd) { while(audio.time < timeEnd) yield return null; StartClip(34.900f,53.300f); //Add your own times here ! } } I have tried coding it myself, but it's quite difficult, and I can't find any tutorials about it...

Viewing all articles
Browse latest Browse all 123

Trending Articles