edited February 2023 in ORK Scripting
Hi,

I have two buttons, as shown on the screen below:

image

And I can't figure out how to "script" them to change language in game.

To check if the language itself will change, I wrote a code in Start method, just like this:

public void Start()
{
Maki.Game.Language = Maki.Languages.Get(0);
}


0 - it's my ID for Polish language and it changes menu language, just like this:

image

When I change ID for "1" - it's English, but I can't force it to work it all on that buttons click... Maybe I'm not smart enough :D Is there a easy way to do it, maybe by schematics, or by code?

Best regards,
Sly
Post edited by Sylwester on
  • The Button component of your button can call functions of a component via it's On Click settings. So, if you have individual functions to set the languages, you can add them to the buttons.
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • edited February 2023
    Yes, I know, but it doesn't work for changing language of Makinom words.

    Example:
    https://i.imgur.com/IGYXHSd.mp4

    On the video, I have things "outside" Makinom framework ("Options" for example) and changing language - as you can see - works fine.

    But "Nowa gra" and the other options, that are set "inside" Makinom, cannot change at all.

    The code itself is simple:
    public void SwitchToPolish()
    {
    Maki.Game.Language = Maki.Languages.Get(1); // which is ID of PL language in Makinom
    }

    public void SwitchToEnglish()
    {
    Maki.Game.Language = Maki.Languages.Get(0); // which is ID of EN language in Makinom
    }
    PL button have method SwitchToPolish() and EN - SwitchToEnglish(). But it doesn't work. And the question is if I'm connecting this wrong, or can't understand how changing languages properly work for Makinom?
    Post edited by Sylwester on
  • What kind of UI is this that's not changing?
    Changing the language like that should recreate HUDs to update languages, but open dialogues or menus are not affected and would need to be closed and reopened.
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • What kind of UI is this that's not changing?
    It's "UI Box with Title (TextMeshPro)" from Makinom > UI Box.
    Changing the language like that should recreate HUDs to update languages, but open dialogues or menus are not affected and would need to be closed and reopened.
    Yes, that's what I thought on the first time.

    But could you tell me if there's a way to close that UI Box? Look on that video below: I tried to check/uncheck the visibility box and everything is set unactive, but that UI Box stays on the screen ;/
    https://i.imgur.com/rq7iK3p.mp4
    So I tried to do what you told -> Click on PL button, then set UI Box to unactive, but as you can see there's no way that this box will hide, I don't know why.
  • edited February 2023
    I assume this is the start menu?
    If that's the case, you can use this code to show it again (closing the current one):
    ORK.StartMenu.menu.Show();

    Setting the UI box (or any UI game object) inactive and active again will not update it's content.
    Post edited by gamingislove on
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • YES, IT WORKS :D!

    Thank you so so much :)!

    Now the button close the menu, load ID for language and open again with proper translation :) Works like a charm.
Sign In or Register to comment.