Welcome, Guest
Username: Password: Remember me

TOPIC: Localize on Awake is now not working (v2.8.0b6)

Localize on Awake is now not working (v2.8.0b6) 2 months 2 days ago #2496

  • RoKo0
  • RoKo0's Avatar
  • Offline
  • New Member
  • Posts: 15
  • Karma: 0
Localize on Awake is now not working in the .exe file.
(but it is working in the editor)
The administrator has disabled public write access.

Localize on Awake is now not working (v2.8.0b6) 2 months 2 days ago #2497

  • RoKo0
  • RoKo0's Avatar
  • Offline
  • New Member
  • Posts: 15
  • Karma: 0
I tryed to debug the standalone build file:

public void OnLocalize( bool Force = false )
{
......

if (!HasTargetCache() && !FindTarget())
return;

the programm exits here
The administrator has disabled public write access.

Localize on Awake is now not working (v2.8.0b6) 2 months 2 days ago #2498

  • RoKo0
  • RoKo0's Avatar
  • Offline
  • New Member
  • Posts: 15
  • Karma: 0
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."
The administrator has disabled public write access.

Localize on Awake is now not working (v2.8.0b6) 2 months 2 days ago #2499

  • RoKo0
  • RoKo0's Avatar
  • Offline
  • New Member
  • Posts: 15
  • Karma: 0
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();
		}
The administrator has disabled public write access.

Localize on Awake is now not working (v2.8.0b6) 2 months 1 day ago #2506

  • Frank
  • Frank's Avatar
  • Offline
  • Administrator
  • Posts: 915
  • Thank you received: 196
  • Karma: 58
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
[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
The administrator has disabled public write access.
Time to create page: 0.140 seconds
Colors