Forum rules - please read before posting.

Different language and one voice-over

Hi
We noticed a feature "Speech and text can be different language" in Speech Manager. I was wondering how exactly it works? English works well. When we switch language to Russian - there is no voice.

Here what we have:

int defaultTextID = 1;
int defaultVoiceID = 1;
. . .
Options.SetLanguage(defaultTextID);
Options.SetVoiceLanguage(defaultVoiceID);

This code executes only on first start of the game.

AC.KickStarter.speechManager.separateVoiceAndTextLanguages is set to True

In code langeauge switches with
Options.SetLanguage(nextLanguageIndex)
where nextLanguageIndex can be only 1 or 2.

We have 2 languages. English - 1 and Russian - 2. Voice-over English only, Default Language is not used. speechManager.ignoreOriginalText set to True.

Sometimes we have such error on start:"The AssetBundle 'en' can't be loaded because another AssetBundle with the same files is already loaded."

Comments

  • Please post the error message in full.

    You say it sometimes appears. Does that mean sometimes voice plays when Russian is set?

    What are your AC and Unity versions?

    The loading of asset bundles occurs in the RuntimeLanguages script's LoadAssetBundle coroutine. What index number is passed and when? (Just place a Debug.Log line to print the value of "i" and see what the Console says).

  • It is full message.
    http://joxi.ru/12MeMV6slEWY82
    It appears on very first start of the game.

    What we do:
    1. Delete PlayerPrefs and Save files
    2. Start Game
    3. In Options change language to Russian
    4. Start new game
    5. No voice overs
    Then if you exit the game, start it again and continue playing - voice over plays with Russian set.
    Just discovered that you can even not switch to Russian. On very first start of the game (considering there are no saves and game prefs) if the error appears - you'll have no voice-over.

    Unity 2019.2.01f
    AC 1.68.4

  • It is full message.

    I need the stacktrace as well - please don't crop it from the screenshot.

    I also need the results of the Debug.Log statement I asked for.

    Then if you exit the game, start it again and continue playing - voice over plays with Russian set.

    So after restarting, the voice/text is corrected?

    In Options change language to Russian

    This is with a Cycle menu element? What is it's "Language type" set to?

    On very first start of the game (considering there are no saves and game prefs) if the error appears - you'll have no voice-over.

    Open up Options.cs, and find lines 167-180:

    if (optionsData.language == 0)
    {
        // Ignore original language
        optionsData.language = 1;
        SavePrefs (false);
    }
    if (optionsData.voiceLanguage == 0 && KickStarter.speechManager.separateVoiceAndTextLanguages)
    {
        // Ignore original language
        optionsData.voiceLanguage = 1;
        SavePrefs (false);
    }
    

    Replace this with the following:

    if (optionsData.language == 0)
    {
        // Ignore original language
        Options.SetLanguage (1);
    }
    if (optionsData.voiceLanguage == 0 && KickStarter.speechManager.separateVoiceAndTextLanguages)
    {
        // Ignore original language
        Options.SetVoiceLanguage (1);
    }
    
  • edited August 2019
    https://cdn.discordapp.com/attachments/515448941009960971/609003248333881354/unknown.png here is the full screenshot

    https://cdn.discordapp.com/attachments/515448941009960971/609364674743500820/unknown.png

    Yes, after restarting everything is ok.
    The Cycle element is our own, nor AC one.

    Here its code


    using AC;

    namespace Specialbit.UI
    {
    public class TextLanguageCycle : CycleButton
    {
    private void OnEnable()
    {
    var languageIndex = Options.GetLanguage();
    UpdateLabel(languageIndex);
    }

    private void UpdateLabel(int languageIdx)
    {
    string label = KickStarter.runtimeLanguages.Languages[languageIdx];
    _label.text = label;
    }

    public override void OnNextValue()
    {
    var nextLanguageIndex = GetNextLanguageIndex(1);
    Options.SetLanguage(nextLanguageIndex);

    UpdateLabel(nextLanguageIndex);
    }

    public override void OnPreviousValue()
    {
    var nextLanguageIndex = GetNextLanguageIndex(-1);
    Options.SetLanguage(nextLanguageIndex);

    UpdateLabel(nextLanguageIndex);
    }

    private int GetNextLanguageIndex(int delta)
    {
    var currentLanguageIndex = Options.GetLanguage();
    var numberOfAvailableLanguages = KickStarter.runtimeLanguages.Languages.Count;

    currentLanguageIndex = currentLanguageIndex + delta;
    if (currentLanguageIndex <= 0)
    {
    currentLanguageIndex = numberOfAvailableLanguages - 1;
    }

    int nextLanguageIndex = currentLanguageIndex % numberOfAvailableLanguages;
    if (nextLanguageIndex == 0) nextLanguageIndex++; //Do not show Original language

    return nextLanguageIndex;
    }
    }
    }


    We've tried the code you wrote above and after Rest we have this:
    https://cdn.discordapp.com/attachments/515448941009960971/609367257780584469/unknown.png

    NullReferenceException: Object reference not set to an instance of an object
    AC.Options.SetLanguage (System.Int32 i) (at Assets/AdventureCreator/Scripts/Options/Options.cs:740)
    AC.Options.LoadPrefs () (at Assets/AdventureCreator/Scripts/Options/Options.cs:170)
    AC.Options.SwitchProfileID (System.Int32 profileID) (at Assets/AdventureCreator/Scripts/Options/Options.cs:598)
    AC.SettingsManager.ShowOptionsSettings () (at Assets/AdventureCreator/Scripts/Managers/SettingsManager.cs:1300)
    AC.SettingsManager.ShowGUI () (at Assets/AdventureCreator/Scripts/Managers/SettingsManager.cs:504)
    AC.AdventureCreator.OnGUI () (at Assets/AdventureCreator/Scripts/Managers/Editor/AdventureCreator.cs:166)
  • What is "en" - the english audio asset bundle?

    Is the red error only occuring in the Editor? It may be a Unity caching issue. What is the state of the issue when only testing builds?

    Please make the changes above, first.

    If the Cycle element is your own, how does it change the language?

    Are you relying on AC for lipsyncing? If so, temporarily disable it.

  • Yes, English asset bundle
    https://monosnap.com/file/3UcVDbai38zOdyv8n7H5KBqDNFpcTv

    is the red error only occuring in the Editor? It may be a Unity caching issue. What is the state of the issue when only testing builds? - Sometimes build has no speech either, but for now we can't catch what it depends from. It seems that "first start no speech" is Editor problem only.

    If the Cycle element is your own, how does it change the language?

    In previous piece of code:
    OnNextValue - OnPreviousValue

    Are you relying on AC for lipsyncing? If so, temporarily disable it.
    We use Salsa2d. Disabling gives no other result.

    With code changed (after cleaning Saves and Prefs)
    "The AssetBundle 'StreamingAssets\en' can't be loaded because another AssetBundle with the same files is already loaded."
    3 yimes in a row without Stack Trace.
    Log tells that index is 1, which is ok.

  • edited August 2019

    Try this replacement for the Options code block I previously mentioned:

    if (optionsData.language == 0)
    {
        // Ignore original language
        if (Application.isPlaying)
        {
            Options.SetLanguage (1);
        }
        else
        {
            optionsData.language = 1;
            SavePrefs (false);
        }
    }
    if (optionsData.voiceLanguage == 0 && KickStarter.speechManager.separateVoiceAndTextLanguages)
    {
        // Ignore original language
        if (Application.isPlaying)
        {
            Options.SetVoiceLanguage (1);
        }
        else
        {
            optionsData.voiceLanguage = 1;
            SavePrefs (false);
        }
    }
    

    Temporarily switch over to the AC Options menu so that the language is changed in the default way. Is there any change then?

  • I cannot recreate the issue here. Going back to your steps:

    1. In Options change language to Russian

    4. Start new game

    What involves "starting a new game"? Is this a case of exit/entering play mode? Or just starting a new scene from a menu in the first scene? If so, is the first scene also an AC one?

    As I am having trouble recreating, I'm afraid I will need to ask you to test another change. This time, please open RuntimeLanguages.cs, and find lines 451-453:

    if (!string.IsNullOrEmpty (languageAudioAssetBundles[i]) &&
    currentAudioAssetBundleName != languageAudioAssetBundles[i] &&
    currentLipsyncAssetBundleName != languageAudioAssetBundles[i])
    

    and replace with:

    if (!string.IsNullOrEmpty (languageAudioAssetBundles[i]) &&
    currentAudioAssetBundleName != languageAudioAssetBundles[i])
    

    With this and the above change, what change - if any - in the issue?

  • Tried the changes above, got two errors:
    https://monosnap.com/file/xQxg0bAW68Lx9Y4UwjPH0HMTCTVKXm

    MainMenu is AC scene. When we click "Start new game" - we load another one, AC too.

  • And no change to the actual behaviour?

    As I've said, I can't reproduce any such issue, and until I can I'm not sure what else I can suggest. If you can create a cut-down project that demonstrates the issue with 2 scenes (menu menu and a new scene to test speech in), then you could PM it to me to have a look at.

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.