Page 1 of 1

How does audio work in 2.0

Posted: Tue Jun 12, 2018 5:01 pm
by chud575
Hi Tony,

I noticed in the v2 demo it auto loads audio files from the resources folder, and they seem to line up with the entrytag format, but other than that i cant figure out whats loading and playing them. Can you explain it please?

Re: How does audio work in 2.0

Posted: Tue Jun 12, 2018 9:56 pm
by Tony Li
Hi,

The Dialogue Manager's Display Settings > Camera & Cutscene Settings > Default Sequence is set to:

Code: Select all

AudioWait(entrytag)
Unimportant details:
Spoiler
In the demo, the Default Sequence is actually "AudioWait(entrytag); Delay({{end}})", but the Delay({{end}}) is unnecessary. It's left over from testing before I received the audio files.
The conversation nodes' Sequence fields are blank, which means they will use the Dialogue Manager's Default Sequence.

The AudioWait() sequencer command plays the audio clip specified by entrytag, which is a unique value for each node. It tries to load the audio clip from a Resources folder.

To get the entrytag values (i.e., audio clip filenames), I exported the database to a voiceover script. I sent this to the audio guy, who recorded the lines and used the entrytags as the filenames.

Re: How does audio work in 2.0

Posted: Sat Aug 04, 2018 9:48 am
by nrvllrgrs
Is it possible to load the audio files in a data structure specific to the level? I have an audio heavy game and I'd prefer not paying for it in memory.

Or is setting the clips to Streaming the best solution?

Re: How does audio work in 2.0

Posted: Sat Aug 04, 2018 11:03 am
by Tony Li
Hi,

Using the Resources folder isn't required. It's just the default for convenience, since it's easy and it works well for most projects.

You can also use AssetBundles. Put each level's audio files in a separate AssetBundle. When you load the level, also load the AssetBundle and call DialogueManager.RegisterAssetBundle(). Sequencer commands like Audio() will automatically locate files in registered AssetBundles. You don't have to change how you use those commands at all. If the file isn't in any registered AssetBundles, it will look in Resources. When you unload the level, call DialogueManager.UnregisterAssetBundle().

You can also use DialogueManager.LoadAsset() for your own purposes to load any files of your own from registered AssetBundles.

If you prefer not to use AssetBundles, you can write your own sequencer commands to handle audio however you want.