Switching GUI Atlases in UISprites
- Wonderwood Games
- Topic Author
- Offline
- New Member
10 years 5 months ago #149
by Wonderwood Games
Switching GUI Atlases in UISprites was created by Wonderwood Games
Dear Frank,
We have found that l2 Localization does not switch UIAtlases in sprites when we switch languages. All sprites and fonts who share the same Atlas texture in our GUI have Localize Script to change atlas when we change language.
We’ve defined Atlases, Sprites and Fonts in localization files as Text.
Fonts are switching correctly (both text (First Term) and UIFont (Second Term)) when we switch languages.
But the same time sprites are disappearing because their UIAtlases don’t change (By default I’ve placed everywhere GUI_EN atlas and when I switch to another language all sprites still have GUI_EN atlases instead of GUI_RU, GUI_FR and so on.
Thank you in advance! This issue is really headache for us!
Please help!
We have found that l2 Localization does not switch UIAtlases in sprites when we switch languages. All sprites and fonts who share the same Atlas texture in our GUI have Localize Script to change atlas when we change language.
We’ve defined Atlases, Sprites and Fonts in localization files as Text.
- We use NGUI
- l2Language prefab is in Resource folder
- Reference atlases and Reference fonts are in the root Resource folder too and l2Language can see all of them correctly.
- There are no Assets in Assets tab of Language Source script in l2Language prefab.
- All fonts have Localize Script with defined First and Second Terms
- All sprites (who share the same atlas with fonts) also has Localize Script with defined First and Second Terms (First is a name of sprite in atlas as Text, Second – is a name of Atlas as Text).
Fonts are switching correctly (both text (First Term) and UIFont (Second Term)) when we switch languages.
But the same time sprites are disappearing because their UIAtlases don’t change (By default I’ve placed everywhere GUI_EN atlas and when I switch to another language all sprites still have GUI_EN atlases instead of GUI_RU, GUI_FR and so on.
Thank you in advance! This issue is really headache for us!
Please help!
Please Log in or Create an account to join the conversation.
- Wonderwood Games
- Topic Author
- Offline
- New Member
10 years 5 months ago #150
by Wonderwood Games
Replied by Wonderwood Games on topic Switching GUI Atlases in UISprites
Hi!
We have found the problem!
This problem became from HD and SD versions of GUI Atlases. in NGUI you must have the same names of sprites in HD and SD versions of GUI Atlases.
There are two lines of code in LocalizeNGUI.cs - 92 and 93 where you check the name of the localizing sprite and if they are the same then it will not switch Reference Atlases:
So we've deleted those two lines and now everything works great!
Best regards!
We have found the problem!
This problem became from HD and SD versions of GUI Atlases. in NGUI you must have the same names of sprites in HD and SD versions of GUI Atlases.
There are two lines of code in LocalizeNGUI.cs - 92 and 93 where you check the name of the localizing sprite and if they are the same then it will not switch Reference Atlases:
if (mTarget_UISprite.spriteName == MainTranslation)
return;
So we've deleted those two lines and now everything works great!
Best regards!
Please Log in or Create an account to join the conversation.
Time to create page: 0.127 seconds