Forum rules - please read before posting.

Translation not working when Scene is played from the Editor

If I start the game from the Unity Editor only some of the Hotspot captions are translated into the currently selected language. If I leave the scene and enter again, all Hotspots are translated. This also applies for my snoop system, which uses
text.text = hotspot.GetFullLabel(AC.Options.GetLanguage());
The text shown is not translated until I leave the scene and enter again.

Comments

  • I'll need more details in order to recreate the problem.

    What are your Unity/AC version numbers, is it for all scenes, and is there a pattern for Hotspots that are working vs not working?

  • Sorry,
    Unity 2018.4.36f1
    AC 1.75.0

    I made a whole lot of tests and I can't find any similarities between the hotspots that are translated from the start and those who aren't. I can say that all hotspots that are affected by this have Speech IDs lower than 100, but there are also hotspots with Speech IDs lower than 100 that work from the start. It happens in several scenes.

    In the built game this will not be problematic at all, but it is weird when you test your scenes from the editor.

  • Do the labels correct themselves if you remain in a broken scene, and cycle through the languages in your Options menu and return to the intended language?

    This might be a caching issue. If you open up Hotspot.cs, look for the UpdateLabel function around line 1280. Paste the following at the end:

    Debug.Log ("Cached Hotspot " + newName + " to '" + cachedLabel + "' for language index: " + languageNumber);
    

    Compare the Console output for a Hotspot that's correct vs one that's wrong. How do they appear?

  • Yes, cycling through the languages fixes it.

    Console messages from hotspots that work correctly:
    Cached Hotspot Brunnen to 'Well' for language index: 1
    Cached Hotspot Schreinerei to 'Carpentry' for language index: 1

    Console messages from hotspots that don't work as expected:
    Cached Hotspot Wegweiser to 'Wegweiser' for language index: 1
    Cached Hotspot Schmied to 'Schmied' for language index: 1

  • Yes, looks like the caches are incorrect.

    I'm presuming that you're 1) Not relying on the Localization package integration, and 2) Not disabling AC Debug Logging at the bottom of the Settings Manager.

    You can remove that line now, but I'll need a new log check elsewhere.

    This time, open up RuntimeLanguages.cs, and look for the following code block inside its GetTranslation function:

    if (originalLine == null)
    {
        ACDebug.LogWarning ("Cannot find translation for '" + originalText + "' because it's Line ID (" + _lineID + ") was not found in the Speech Manager.");
    }
    

    At the end of this, paste in:

    else ACDebug.LogWarning ("Translation for " + originalText + " not created (line ID = " + _lineID + ")");
    

    Does this show up as a warning message for the Hotspots with the issue?

  • Yes, there are log entries for all hotspots, that aren't working. Some examples:
    Translation for Kirche not created (line ID = 93)
    Translation for Wegweiser not created (line ID = 95)

  • OK. Try this fix: open up the Options script, and paste in the following at the bottom of the OnInitPersistentEngine function:

    KickStarter.eventManager.Call_OnChangeLanguage (optionsData.language);
    

    Does that resolve it?

  • Yes, works perfectly with this fix.

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.