Hello,
We have multiple voice options for our player. We choose it at the beginning. we can assign a global variable to keep the id of the selected voice.
The question is how can we play the audio for the chosen voice id?
Is it possible if I organize the files such as
resources/player1/voice1.mp3
resources/player2/voice1.mp3
then do i need to edit the speech scripts to assign the correct folder?
this is only for the player and the npcs have single voice.
any directing would be perfect.
thanks
Comments
This should be possible by separating your voice type by Player prefab.
In the Settings Manager, set Player switching to Allow, and create as many Player slots as you have voice types.
You'll need to duplicate your Player prefab (and give each a unique name, e.g. "Player_Gruff", "Player_Cool" etc), and assign each into the Settings Manager as a separate registered Player.
Then, in the Speech Manager, check the following three options:
You'll probably need to re-gather your lines, but you should then find that each player speech line listed below now has separate audio paths and filenames for each Player.
thanks, this handles the request.
just two questions.
1) if it was a single player the audio path is Resources/Speech/player5.mp3
can't seem to find where I should put the audio when it is speaker subfolders.
is it Resources/Speech/Player1/5.mp3
Resources/Speech/Player2/5.mp3
?
2) are we able to use the addressables system for the assetbundle option?
extra: are we able to save the current selected player? if so I wouldn't need to save the player id as a global variable
Thanks
1) As a character's name is incorporated into the filename - regardless of folder - you should avoid ending your character names with numbers. Otherwise, "Player15.mp3" could either refer to Player's line 15 or Player 1's line 5.
If you renamed your two Players to PlayerA and PlayerB, the audio paths would be:
Resources/Speech/PlayerA/PlayerA15.mp3
Resources/Speech/PlayerB/PlayerB15.mp3
Selecting a gathered speech line in the Speech Manager will always tell you of the expected filename and filepath. You'll also get a Console error with this information if the audio cannot be found when the line is spoken.
2) Not currently. Asset bundles must be referred to by filename - though I'd recommend relying on Resources during development and switch to Asset bundles towards the end.