Welcome,
Guest
. Please
login
or
register
.
April 23, 2026, 01:22:29 AM
Home
Help
Search
Login
Register
Tasharen Entertainment Forum
»
Support
»
NGUI 3 Support
»
Localization bug: clears current locale when duplicated
« previous
next »
Print
Pages: [
1
]
Author
Topic: Localization bug: clears current locale when duplicated (Read 2589 times)
Konstantin
Newbie
Thank You
-Given: 0
-Receive: 0
Posts: 6
Localization bug: clears current locale when duplicated
«
on:
April 17, 2014, 08:57:51 AM »
Let's assume we have a scene with Localization script. It is loaded twice and Localization is duplicated. The second instance will destroy itself, but it will also break static fields. Here is some code from Localization.cs:
void
Awake
(
)
{
if
(
mInstance
==
null
)
// mInstance is not null, this is the second Localization
{
...
}
else
Destroy
(
gameObject
)
;
// Destroy duplicate which will call OnDisable
}
void
OnDisable
(
)
{
localizationHasBeenSet
=
false
;
mLanguageIndex
=
-
1
;
mDictionary
.
Clear
(
)
;
// BOOM! current locale texts wiped out
mOldDictionary
.
Clear
(
)
;
}
Logged
ArenMook
Administrator
Hero Member
Thank You
-Given: 337
-Receive: 1171
Posts: 22,128
Toronto, Canada
Re: Localization bug: clears current locale when duplicated
«
Reply #1 on:
April 17, 2014, 12:18:26 PM »
Thanks! Add the "if (mInstance != this) return;" to the top of OnDisable.
P.S. There is no reason to add the Localization script to the scene anymore. I strongly advise you to remove it as with the next update you will get errors otherwise.
«
Last Edit: April 17, 2014, 01:08:51 PM by ArenMook
»
Logged
Print
Pages: [
1
]
« previous
next »
Tasharen Entertainment Forum
»
Support
»
NGUI 3 Support
»
Localization bug: clears current locale when duplicated