Addressables audio won't loop

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
VoodooDetective
Posts: 222
Joined: Wed Jan 22, 2020 10:48 pm

Addressables audio won't loop

Post 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.
User avatar
Tony Li
Posts: 22054
Joined: Thu Jul 18, 2013 1:27 pm

Re: Addressables audio won't loop

Post 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().
VoodooDetective
Posts: 222
Joined: Wed Jan 22, 2020 10:48 pm

Re: Addressables audio won't loop

Post by VoodooDetective »

Thanks for those details! I'll try to put together an example and then reply. Sorry I should have done that first.
VoodooDetective
Posts: 222
Joined: Wed Jan 22, 2020 10:48 pm

Re: Addressables audio won't loop

Post 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?
User avatar
Tony Li
Posts: 22054
Joined: Thu Jul 18, 2013 1:27 pm

Re: Addressables audio won't loop

Post by Tony Li »

It follows regular Addressables rules. In general this means it will unload when the scene changes.
VoodooDetective
Posts: 222
Joined: Wed Jan 22, 2020 10:48 pm

Re: Addressables audio won't loop

Post 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.
'''"
User avatar
Tony Li
Posts: 22054
Joined: Thu Jul 18, 2013 1:27 pm

Re: Addressables audio won't loop

Post 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.
VoodooDetective
Posts: 222
Joined: Wed Jan 22, 2020 10:48 pm

Re: Addressables audio won't loop

Post 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.
User avatar
Tony Li
Posts: 22054
Joined: Thu Jul 18, 2013 1:27 pm

Re: Addressables audio won't loop

Post by Tony Li »

Good idea. I'll make it a checkbox, ticked by default to unload assets on scene unload.
Post Reply