using System.Collections; using System.Collections.Generic; using UnityEngine; public class Caraudio : MonoBehaviour { // Start is called before the first frame update public float timelenth; public float timelenth2; public AudioClip []Music; void Start() { } public void OnEnable() { StartCoroutine(playmusic()); StartCoroutine(playmusichoner()); //Invoke("playmusic", timelenth); //Invoke("playmusichoner", timelenth2); } public IEnumerator playmusic() { yield return new WaitForSeconds(11f); this.gameObject.GetComponent().clip=Music[0]; this.gameObject.GetComponent().Play(); } public IEnumerator playmusichoner() { yield return new WaitForSeconds(28f); this.gameObject.GetComponent().clip = Music[1]; this.gameObject.GetComponent().Play(); } // Update is called once per frame void Update() { } }