[HOWTO] How To: Use Addressables to Play Audio Files

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
User avatar
Tony Li
Posts: 22108
Joined: Thu Jul 18, 2013 1:27 pm

[HOWTO] How To: Use Addressables to Play Audio Files

Post by Tony Li »

If you don't specify otherwise, sequencer commands such as AudioWait(filename) will look in folders named Resources for filename.

If you prefer, you can put your audio files in asset bundles instead. In this case, use DialogueManager.RegisterAssetBundle() to make the asset bundle available to the Dialogue System.

Or you can use Addressables. Here's an easy way to set it up:
  • Import Unity's Addressables package.
  • In the Dialogue System's Welcome Window, tick the USE_ADDRESSABLES checkbox.
  • Name your audio files according to their entrytags.
  • Move your audio files into the root of a Resources folder.
  • Tick the audio files' Addressable checkboxes. Unity will ask if you want to move the audio files out of the Resources folder. Click yes. When Unity moves the files, it will set their Addressable keys to the name of the audio file. AudioWait(entrytag) will look up Addressable audio files by this key. Make sure to move the audio files into the root of Resources folders before ticking the Addressable checkbox; otherwise this process will include the path inside the Resources folder in the key.
  • The Dialogue System will automatically use the audio files just like they were in Resources, except you don't need to worry about where in the project they're located. When AudioWait() is done playing, it will automatically unload the audio file from memory.
qiihyb8785
Posts: 1
Joined: Sun Jun 30, 2024 4:35 pm

Re: [HOWTO] How To: Use Addressables to Play Audio Files

Post by qiihyb8785 »

Thanks!
Post Reply