Unnecessary forced LocalizeAll?

More
5 years 9 months ago - 5 years 9 months ago #3512 by studenman
I noticed several places in the I2 Loc code there are calls to LocalizeAll(true) that don't make a lot of sense. For example, LocalizationParamsManager should only affect the parameters of the current object, and yet whenever it enables, it forces all Localize objects in all loaded scenes to localize, even if those objects are disabled. If LocalizationParamsManagers are on objects within hidden screens or UIs that are made active, there is a CPU hit while all localized objects in the game get re-localized, even if they may never be shown to the user during this session.

Can you explain the reasoning behind these LocalizeAll(true) calls?

Follow Tiny Bubbles Development:
Twitter | Facebook | Web
Last edit: 5 years 9 months ago by studenman.

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

More
5 years 9 months ago #3519 by Frank
Hi,
LocalizeParameters by default are Global Parameters. They don't just modify the Localize object that its in the same GameObject.

Because they are Global Parameters, when they are enabled, they register into the LocalizationManager.ParamManagers list and relocalize all objects so that they get updated if they are using Parameters.
Normally, you would only have LocalizationParamsManager in your scene with all the parameters in there.

If you need to have a Parameter object that only applies to the GameObject it is in, and so it doesn't have to localize all. You can inherit from the ParamManager and skip registering into the globa list.
You can use the following class:
using UnityEngine;
using System;
using System.Collections.Generic;

namespace I2.Loc
{
    public class LocalParamsManager : LocalizationParamsManager
	{
        public virtual void OnEnable()
        {
        }
    }
}

Said that, there used to be an option in that class to select if the manager was local or global. But because of a bug in one of the unity versions, that was failing to build for IOS for some users.

I found a solution for that issue (at least a workaround for that unity bug), so I could bring back that option.
Will try to add it into the next beta.

Hope that helps,
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
5 years 8 months ago #3520 by studenman
Thanks Frank. That's good to know because I assumed it was local before and I may have param name conflicts.

I think the local/global flag would be very helpful. "Auto register" is a confusing name, but a Global/Local enumerator would be very nice to have. Or like you suggest, make GlobalParams/LocalParams classes and switch the LocalParamsManager meta GUID to become a GlobalParamsManager class.

For now since all my LocalizationParamsManagers are local, I'll just comment out DoAutoRegister() in LocalizationParamsManagers.OnEnable()

Follow Tiny Bubbles Development:
Twitter | Facebook | Web

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

Time to create page: 0.164 seconds
Template by JoomlaShine