SetTerm won't update

More
4 years 2 months ago #916 by Stiv
Replied by Stiv on topic SetTerm won't update
Thanks for looking into it. I've since discovered a number of other places it's not working so I don't think my problem is just on prefabs now. I should have also mentioned I'm using TextMesh Pro for all my text.

I just tried creating a new blank project and everything works ok there so I guess I'm a bit stuck.

One really weird thing I just noticed is that if I press the translate button in my main project, it puts the key name / category as the translation instead of an actual translation. Never seen that before and it doesn't happen in the test project.

If I can work out how to replicate the SetTerm issue outside of my project I'll let you know. If not I guess I'll roll back to the last working version (the version on the asset store).

Thanks again.

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

More
4 years 2 months ago #917 by Frank
Replied by Frank on topic SetTerm won't update
Just to double check:

Are you using the I2Languages.prefab for your localizations?
Do you have any other LanguageSource instantiated in your scene?

Are you :-) Give I2L 5 stars!
Are you :-( Please lets us know how to improve it!
To get the betas as soon as they are ready, check this out

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

More
4 years 2 months ago #918 by Stiv
Replied by Stiv on topic SetTerm won't update
Yes just the I2Languages.prefab in Assets>I2>Localization>Resources, no other language sources.

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

More
4 years 2 months ago #938 by Stiv
Replied by Stiv on topic SetTerm won't update
Just a final update to close this one off, I was able to solve my problem by making the following change to OnLocalize:
public void OnLocalize( bool Force = false )
{
   if (!Force && (!enabled || !gameObject.activeInHierarchy))
      return;
Somehow my calls to "SetTerm" where getting lost, possibly because they were set when not active and later when it was activated "OnEnable" didn't update it because the "CurrentLanguage" hadn't changed. Not totally sure, but this is working for me now so I'm happy :)

(Oh, and this is 2.6.0 b6)

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

More
4 years 2 months ago #940 by Frank
Replied by Frank on topic SetTerm won't update
Hi,
Thanks for finding this workaround. I will check why it could have been failing and include the fix in the next beta!

Thanks!!
Frank

Are you :-) Give I2L 5 stars!
Are you :-( Please lets us know how to improve it!
To get the betas as soon as they are ready, check this out

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

More
4 years 2 months ago #943 by Stiv
Replied by Stiv on topic SetTerm won't update
Hi frank, I think my suspicions where correct. This is how I've been able to reproduce it in a blank project:

Have a localized label visible on scene load (I'm using TextMesh Pro in case it makes a difference). Later set it inactive. Call SetTerm while inactive. Enable the label again later and it will still be the original term.

This was my very simple test case:
    public Localize label;
    public float counter = 0f;

    void Update ()
    {
        if (counter < 1f && counter + Time.deltaTime >= 1f)
        {
            // Set inactive
            label.gameObject.SetActive(false);
        }
        else if (counter < 2f && counter + Time.deltaTime >= 2f)
        {
            // Change term
            label.SetTerm("Label/Test2");
        }
        else if (counter < 3f && counter + Time.deltaTime >= 3f)
        {
            // Set active again
            label.gameObject.SetActive(true);
        }

        counter += Time.deltaTime;
    }

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

Time to create page: 0.315 seconds
Template by JoomlaShine