Forum rules - please read before posting.

Language Change Event has no Effect on Active Menu

edited February 2019 in Technical Q&A

Hello everyone,

my first scene contains a "Start Menu" that contains two buttons (flags).

Screenshot: https://imgur.com/a/11IyWSr

The buttons executes following code:

public void ChangeLanguageToGerman()
{
AC.Options.SetLanguage(0);
}

public void ChangeLanguageToEnglish()
{
AC.Options.SetLanguage(1);
}

The OptionData changes, and the language is correct in the following scene. But nothing changes in the current scene.

I want to have the visible menu in the current scene in the new language. Do the AC menu's not react on a OnChangeLanguage event? Do I have to reload the scene? Or did I missed something?

Thanks,
André

Comments

  • Update:
    I found out, that, when I close and open the menu, the language will be updated. Is that the work-a-round?

    • What are your AC/Unity versions>
    • What are the types of elements that aren't updating
    • What is your Menu's Appear type field set to?
    • Are you rendering the Menu with Unity UI?

    See the Manual's "Menu scripting" chapter. You may have to call the following after:

    KickStarter.playerMenus.RecalculateAll ();
    
    • I'm using Unity 2018.3.6f1 and AC 1.66.8
    • Types are "Buttons"
    • Appear type is "Manual"
    • Yes, I'm using Unity UI

    image

    Using of KickStarter.playerMenus.RecalculateAll didn't work:

    public void ChangeLanguageToEnglish()
    {
        AC.Options.SetLanguage(1);
        AC.KickStarter.playerMenus.RecalculateAll();
    }
    
  • Maybe it's because of Source: "Unity UI In Scene"???

  • Shouldn't be - it should update regardless of the Source option.

    You could test this, however, by changing it back to Adventure Creator temporarily.

    As a workaround, if turning the menu off and on again does the trick, you could try doing this in code:

    public void ChangeLanguageToEnglish()
    {
        AC.Options.SetLanguage(1);
        AC.PlayerMenus.GetMenuWithName ("Home").ForceOff ();
        AC.PlayerMenus.GetMenuWithName ("Home").TurnOn (false);
    }
    
  • Hello Chris,

    your work-a-round does the trick. I will test some other things later, when I will have some time.

    Thanks so far.

    When I understand you correctly, normally the menu's should react to a change of the language without doing special things? If not, it could may be a good idea to add this feature. :-)

    If I find more things out, I will post it here.

    Best regards,
    André

  • When I understand you correctly, normally the menu's should react to a change of the language without doing special things?

    Like I said, it should update. I can't recreate the issue, but you're using custom scripts and there may be some key element missing that you're performing and I'm not.

  • The problem was, that I deactivated the "Menu System". That was the reason, why the menu's didn't update according to the language change.

    But I wonder why: After deactivating the "Menu System", it is still possible to turn menu's on and off. And they still react on button clicks. Why do they not respond to language changes? I think they should.

    Thanks for your quick response anyway.

    André

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.