Localize on Awake is now not working (v2.8.0b6)
7 years 2 months ago #2496
by RoKo0
Localize on Awake is now not working (v2.8.0b6) was created by RoKo0
Localize on Awake is now not working in the .exe file.
(but it is working in the editor)
(but it is working in the editor)
Please Log in or Create an account to join the conversation.
7 years 2 months ago #2497
by RoKo0
Replied by RoKo0 on topic Localize on Awake is now not working (v2.8.0b6)
I tryed to debug the standalone build file:
public void OnLocalize( bool Force = false )
{
......
if (!HasTargetCache() && !FindTarget())
return;
the programm exits here
public void OnLocalize( bool Force = false )
{
......
if (!HasTargetCache() && !FindTarget())
return;
the programm exits here
Please Log in or Create an account to join the conversation.
7 years 2 months ago #2498
by RoKo0
Replied by RoKo0 on topic Localize on Awake is now not working (v2.8.0b6)
And here is what I have read in the unity's documentation:
"Methods marked [RuntimeInitializeOnLoadMethod] are invoked after the game has been loaded. This is after the Awake method has been invoked."
"Methods marked [RuntimeInitializeOnLoadMethod] are invoked after the game has been loaded. This is after the Awake method has been invoked."
Please Log in or Create an account to join the conversation.
7 years 2 months ago #2499
by RoKo0
Replied by RoKo0 on topic Localize on Awake is now not working (v2.8.0b6)
My fix of Localize.cs:
public static bool firstStart = false;
void Awake()
{
if (!firstStart)
{
LocalizeTarget_UnityUI_Image.AutoRegister();
LocalizeTarget_UnityUI_RawImage.AutoRegister();
LocalizeTarget_UnityUI_Text.AutoRegister();
firstStart = true;
}
FindTarget();
if (LocalizeOnAwake)
OnLocalize();
}
Please Log in or Create an account to join the conversation.
7 years 2 months ago #2506
by Frank
Are you Give I2L 5 stars!
Are you Please lets us know how to improve it!
Replied by Frank on topic Localize on Awake is now not working (v2.8.0b6)
Hi,
Thanks for reporting this issue.
This was introduced in the latest version as I'm trying to decouple the Targets from the actual Localization (to allow more targets to be added without modifying the main code). That's why now all the targets now autoRegister themselves.
You are right about the incorrect call order!
I modified the code now to make the AutoRegister method be called before any Awake function.
What I did was to change the [RuntimeInitializeOnLoadMethod] lines by
That way, they are executed before any object is loaded/initialized.
This change is now available in 2.8.1a1,
Hope that helps,
Frank
Thanks for reporting this issue.
This was introduced in the latest version as I'm trying to decouple the Targets from the actual Localization (to allow more targets to be added without modifying the main code). That's why now all the targets now autoRegister themselves.
You are right about the incorrect call order!
I modified the code now to make the AutoRegister method be called before any Awake function.
What I did was to change the [RuntimeInitializeOnLoadMethod] lines by
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)]
That way, they are executed before any object is loaded/initialized.
This change is now available in 2.8.1a1,
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.
Time to create page: 0.178 seconds