private void Awake() { targetGameObject = new GameObject(); audioPlayer = targetGameObject.AddComponent <AudioSourcePlayer>(); audioPlayer.AudioPlayCompleted.AddListener(OnAudioPlayCompleted); AudioClip clip = Resources.Load <AudioClip>("Audio/Sounds/Ring"); audioPlayer.PlayAudio(clip); }
private void Awake() { targetGameObject = new GameObject(); audioPlayer = targetGameObject.AddComponent <AudioSourcePlayer>(); AudioClip clip = Resources.Load <AudioClip>("Audio/Music/Loop"); audioPlayer.PlayAudio(clip); Invoke("FadeOutLater", 3f); }
private void OnResult(UnityHttpClient httpClient, UnityHttpResponse response) { UnityHttpResponseAudioClip audioResp = (UnityHttpResponseAudioClip)response; AudioClip clip = audioResp.AudioClip; audioGameObject = new GameObject(); AudioSourcePlayer player = audioGameObject.AddComponent <AudioSourcePlayer>(); if (player) { player.AudioPlayCompleted.AddListener((AudioSourcePlayer p, EventArgs e) => { Destroy(audioGameObject); IntegrationTest.Pass(); }); player.PlayAudio(clip); } }