Problem
I get AudioClip via Addressable Asset System and pass it to AudioSource for playback. If I set the PlayMode to Use Asset Database, it plays fine, but if I specify Use Existing Build, it doesn't play. Please help me.
Things I tried
I did New Build > Default Build Script from Addressable Group window, but the situation does not improve. In addition, even if Clean Build is executed, it is the same.
I thought that the acquisition itself is not done, and I displayed the name of AudioClip acquired with DebugLog, but it is displayed normally, and acquisition is thought to be done well.
But when I look at it in the editor, AudioClip is not registered in AudioSource and VoiceTrack.clip = clip is not completed normally.I tried switching the AssetBundleCompression setting to UnCompressed, but it had no effect.
Versions
- Unity Version 2021.3.10f1
- Addressables Version 1.19.19
Code in the relevant section
main.cs
public async UniTask ExecuteAsync(CallInstReference reference, InstRunner runner, CancellationToken cancelToken)
{
AudioClip clip = await Addressables.LoadAssetAsync<AudioClip>(clipAddress.Get());
reference.world.callSoundManager.PlayVoice(clip, duration );
Addressables.Release(clip);
}
callSoundManager.cs
public void PlayVoice( AudioClip clip , float duration = 0.2f , bool loop = false)
{
Debug.Log(clip.name + " voiceStart"); //currect clip name displayed.
VoiceTrack.clip = clip; //no clip attached the audioSource in Editor
VoiceTrack.loop = loop;
VoiceTrack.Play();
VoiceTrack.DOFade(1f, duration);
}
If anything is missing, please comment. Thank you.