LocalizationManager.GetTranslatedObject<AudioClip> returns null

More
5 years 6 months ago #3867 by jbullrich
Hello!
when calling LocalizationManager.GetTranslatedObject<AudioClip>("EXAMPLE"); it returns a null value.

I tried using the Localize component with the same key and it get the audio clip in the Audio Source, so I know that the audio is correctly loaded. Is this a expected behavior? I didn't find any of this in the documentation.

How can I get the AudioClip object through script?

Thanks

Please Log in or Create an account to join the conversation.

More
5 years 6 months ago #3869 by jbullrich
I manage to make it work. It was a little harder than expected
var data = LocalizationManager.GetTermData(key);
var currentIndex = LocalizationManager.GetAllLanguages().IndexOf(LocalizationManager.CurrentLanguage);
var audioFile = data.GetTranslation(currentIndex);
return LocalizationManager.GetTranslatedObject<AudioClip>(audioFile);

Please Log in or Create an account to join the conversation.

Time to create page: 0.194 seconds
Template by JoomlaShine