Switching GUI Atlases in UISprites

More
9 years 9 months ago #149 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.
  1. We use NGUI
  2. l2Language prefab is in Resource folder
  3. Reference atlases and Reference fonts are in the root Resource folder too and l2Language can see all of them correctly.
  4. There are no Assets in Assets tab of Language Source script in l2Language prefab.
  5. All fonts have Localize Script with defined First and Second Terms
  6. 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.

More
9 years 9 months ago #150 by Wonderwood Games
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:
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.241 seconds
Template by JoomlaShine