I have a dialog tree system for a project I am working on. It reads an XML file that contains all the dialog nodes, player responses and actions to be taken based on responses. I am needing to now add sound to the dialog system, and for the life of me I can’t figure out a good way to do it.
I have a pile of .wav files for the dialog nodes all ready to go. I can specify new attributes in the XML file to tell each dialog node or player response where to look for the appropriate sound file. My problem is getting these sound clips out of the asset directory they’re sitting in and attaching them to an AudioSource at runtime. I can’t set up individual objects for them because of the sheer number of audio clips involved.
How does one go about grabbing audio files out of a directory at runtime for playback?
Any help is appreciated.