Voices
v4.0
Overview
The Voices module makes it easy to organize and make use of multiple styles of audio (voices) which all aim to communicate the same message (lines), often in various ways (emotions).
While this module can easily be used in many other ways, the original intent is for projects where players can choose the voice of their character(s), or many NPCs say very similar lines. With a special naming convention applied to your AudioClip
files, the module will automatically set up the entire storage structure and populate the clips in the proper fields.
From there, you simply need to assign a Voice
object to your player or other character, and create a Speak(string line)
method to hear the AudioClip
.
Naming Convention for Auto Population
The object can auto-populate based on the AudioClips
in a folder.
To use the auto populate feature, each AudioClip
should be named appropriately using this convention:
[VoiceName]_[LineName]_[EmotionName]_[UniqueString]
Only the first two name segments are required. Emotion and the unique string are both optional.
Setup
Create a new folder called /Voices
or something similar in your project. Right-click and select:
/Create/Game Modules/Create/Voices
This will create an Voices
Scriptable Object in your project. Select that and view the Inspector to begin setting up your data. You can rename this object if you'd like. You can also have multiple Voices
objects in your project as well.
Any character which can speak, or object which will have a "voice" from the Voices
module, should have a Voice
object on it. See the VoicesDemoPlayer
class for an example:
Your game controller, if you have one, or other object, can set the value of voice
in various ways. View the VoicesDemoControl
class for an example in our demo scene:
Last updated