Forum rules - please read before posting.

Using Addressables for speech audio and Character Switching

Hello AC Forums.

In order to avoid the long load times for asset bundles in my fully voiced game, I've switched over to playing speech audio by addressable. This was going great, instant availability of samples when I load up a save game, but I've hit a snag with my player character's dialogue.

I use character switching, primarily to let the user choose between a male or female voice actor. The player is set up with "use player prefab name in filenames" and "player lines have separate audio for each player?" options ticked. In the speech menu, the player's lines show both options, i.e.: Avatar_FXXX and Avatar_MXXX where XXX is the line ID as the expected filename, and the addressable "key" name is set as that same filename.

However, when a line player dialogue is encountered in the game, no voice sample plays, and the console shows the following errors:

Exception encountered in operation CompletedOperation, status=Failed, result= : Exception of type 'UnityEngine.AddressableAssets.InvalidKeyException' was thrown., Key=Player885, Type=UnityEngine.AudioClip
UnityEngine.AddressableAssets.Addressables:LoadAssetAsync<UnityEngine.AudioClip> (object)

Exception encountered in operation ChainOperation<AudioClip> - UnityEditor.AddressableAssets.Settings.FastModeInitializationOperation, result='', status='Succeeded', status=Failed, result= : ChainOperation of Type: UnityEngine.AudioClip failed because dependent operation failed
Exception of type 'UnityEngine.AddressableAssets.InvalidKeyException' was thrown., Key=Player885, Type=UnityEngine.AudioClip

We can see here that the game seems to be looking for Player885, rather than Avatar_F885 or Avatar_M885. Changing the key to Player885, results in the audio playing, but defaulting to the Avatar_F version (the default player) regardless of whether Avatar_M is the active player.

I also tried changing the speaker label of the two players to Avatar_F and Avatar_M, but this doesn't affect it in any way I can see.

Any pointers for using the addressable speech audio system with character switching?




Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.