Comment on page
Voices
v3.0
This is the main "Voices" scriptable object which is created when creating the Voices Module. Once this is populated, you need to attach it to your game controller, or other object in your game. A reference to this object is required for switching or assigning Voice objects at runtime.
There are three tabs available which will allow you to manage the Voices, Lines, and Emotions. Expanding the Show Auto Fill foldout will allow you to make use of the Auto Fill feature, explained below. The Manage Types foldout will allow you to manage types you've added using the Add new type box.

Select your directory containing your
AudioClips
which will be used in this Voices
object in the provided field. Then, click the "Auto Fill Contents". If you have named your AudioClip
files correctly, the script will automatically create Voices, Lines, and Emotions, and populate the AudioClips
for you. This feature will not delete any current data. If you add new AudioClips
to your project, you can run this again to add the new content to the module.
Expanding a voice, you'll be able to populate the AudioClips for each line and emotion, as well as the default clips for each line. You can also delete the voice.

Line or Emotions that do not have any
AudioClips
assigned will be grey. Drag an audio clip into one of these fields (marked "Add new AudioClip here") to add a clip to the list. Each Line/Emotion can have multiple audio clips attached to it. This way you can have different versions of the same line/emotion, which can be randomly played at runtime for variety.It is not required to populate all
AudioClip
fields -- only the ones you are using in your project.The Lines tab allows you to add and rename lines. Good practice may be to use
CamelCase
to name each line something logical you can remember. The string you assign here is what you will be calling as part of the PlayClip
method. When you add, rename, or delete a Line, all of the Voice objects in the Voices scriptable object will be updated.
Emotions are optional. They are intended to be used for major variations of lines. As an example, you may have a line a player can say, "Let's get out of here" (which would be called
LetsGetOutOfHere
). You may wish to have various emotions for this and other lines such as "Frightened" or "Confident" or "Dying" etc.When you add, rename, or delete an Emotion, all of the Line objects on all of the Voice objects in the Voices scriptable object will be updated.

// Returns an audio clip from the voice/line combination provided, or the
// emotion if one is provided. If index is not -1 and there are multiple
// AudioClips in the resulting list, a random AudioClip will be returned.
GetAudioClip(string voiceName, string lineName, string emotionName = "", int index = -1)
// This will return a Voice object given the voiceName or index
// provided. This can be used to assign a specific Voice to an object in
// your game.
GetVoice(string voiceName)
GetVoice(int index)
// This will return a random voice from the available Voice objects.
GetRandomVoice()
// This will return a List<Voice> with all voices of the type specified.
GetVoicesOfType(string typeToGet)
// Use this to get the next voice of a named type. Pass in -1 for the
// next parameter to get the previous voice object.
GetNextVoiceOfType(string typeToGet, Voice currentVoice, int next = -1)
// Use this to get the next voice. Pass in -1 for the next parameter
// to get the previous voice object.
GetNextVoice(Voice currentVoice, int next = -1)
// Returns true if the provided lineName exists.
HasLine(string lineName)
// Returns true if the provided emotionName exists.
HasEmotion(string emotionName)
// Returns true if the provided voiceName exists.
HasVoice(string voiceName)
Last modified 5mo ago