Page 1 of 1

Addressables audio won't loop

Posted: Sat Jul 04, 2020 1:22 am
by VoodooDetective
I think there may be an issue with addressables where audio won't loop.

Node 1:

Code: Select all

Audio(Sound/SFX/The Office/Letters Flaming, Short Sleeve Studios Presents Title SFX Audio)
Node 2:
Doesn't matter what's here, the audio stops.

Re: Addressables audio won't loop

Posted: Sat Jul 04, 2020 8:34 am
by Tony Li
Hi,

I can't reproduce this. Can you give me some reproduction steps?

Is it possible that something else is stopping the audio?

Also, please be aware that AudioWait() will load the addressable, play it, and then unload it. Audio(), on the other hand, doesn't know when you're going to be done with the audio clip, so it doesn't unload it. If it's OK to keep it loaded in memory, you don't need to do anything extra. However, if you want to unload it from memory, pass the audio source's clip to DialogueManager.UnloadAsset().

Re: Addressables audio won't loop

Posted: Mon Jul 06, 2020 9:44 pm
by VoodooDetective
Thanks for those details! I'll try to put together an example and then reply. Sorry I should have done that first.

Re: Addressables audio won't loop

Posted: Fri Aug 28, 2020 5:56 pm
by VoodooDetective
I was just thinking about this more. So if I use Audio(), does that mean that unless I manually unload the clip, it stays in memory forever, or will it be unloaded when the scene changes?

Re: Addressables audio won't loop

Posted: Fri Aug 28, 2020 8:38 pm
by Tony Li
It follows regular Addressables rules. In general this means it will unload when the scene changes.

Re: Addressables audio won't loop

Posted: Mon Aug 31, 2020 3:19 pm
by VoodooDetective
I was asking about that on the Unity forum with respect to loading in animation clips and someone said:


https://forum.unity.com/threads/are-add ... ge.960261/
"""
The only assets that are cleaned up on scene loads are those that are loaded through Addressables.InstantiateAsync. Anything else that is loaded through Addressables.LoadAssetAsync (like your animation clips) will need to be unloaded manually. Using the scene manager's callbacks for that purpose should work.
'''"

Re: Addressables audio won't loop

Posted: Mon Aug 31, 2020 3:42 pm
by Tony Li
I'll put this question out the Dialogue System community.

Should audio addressables loaded via Audio() be unloaded when the scene changes?

Pro: Easiest automated cleanup.

Con: If they're commonly used, they'll need to be loaded again the next time they're used.

Unless I hear strong arguments otherwise, I'll set them to be unloaded when the scene is unloaded.

Re: Addressables audio won't loop

Posted: Mon Aug 31, 2020 4:10 pm
by VoodooDetective
Sounds good! I'll opine there :). Maybe it could be a conditional checkbox even. I'm sure some games have lots of unique dialogue like adventure games (me :) and some not so much.

Re: Addressables audio won't loop

Posted: Mon Aug 31, 2020 4:26 pm
by Tony Li
Good idea. I'll make it a checkbox, ticked by default to unload assets on scene unload.