Works in editor but not in build - addressables build done

Hi,

edit this is now confirmed as a bug, feel free to upvote for the bug to be fixed thanks!:
https://issuetracker.unity3d.com/issues/teshmeshpro-text-is-not-displayed-in-the-play-mode-when-using-localization

The localization works well on editor. but when i try to do it on build on an actual Iphone device I get the below. On the screen, the text becomes blank, probably because no font asset is found. However, it seems to only happens after i do an Addressables loadScene.

Please assign a Font Asset to this Text (TMP) gameobject.
TMPro.TextMeshProUGUI:Rebuild(CanvasUpdate)
UnityEngine.UI.CanvasUpdateRegistry:performUpdate()
UnityEngine.WillRenderCanvases:Invoke()

I confirm that i have done the addressables ā€˜New buildā€™. Many times in fact. I also have done the Addressables Analysis - no errors.

Any ideas?

8035601--1036139--upload_2022-4-10_23-28-27.png

Hi,
I have not seen this issue before. Could you please file a bug report so we can investigate?

Hi Karl, thanks for responding. Submitted https://fogbugz.unity3d.com/default.asp?1419084_cjlbvkiprbq37i85 (Case 1419084). I created a whole new app within nothing but two scenes, two tmp_texts, two buttons, addressables/localization, and is able to replicate the problem.

I also added a screenshot on how it looks on unity vs the actual app. Itā€™s a bit strange, the initial scene is fine but after addressables loading, all the text goes blank.

(Also i dont know why but my phone is in Chinese yet the app dosenā€™t change anything, on scene1).

Ah great, can you submit this with a bug report? https://unity3d.com/unity/qa/bug-reporting

Hi Karl, sorry not sure if i was doing it correctly. I looked at the link you provided and followed the steps. I submited the bug in unity ā†’ Help->Report a Bug in the menu

Can i also ask a stupid question, i saw in some threads there were samples but i couldnā€™t find any link. Is there a demo / or sample repository/scene somewhere which I can take a look to see?

Yes thatā€™s correct.
The samples are in the package manager window under the localization package details. There is a section near the bottom of the panel

Found it! Maybe could be mentioned in the documentation (maybe in the installation notes!).

1 Like

Hi, I spent almost two days trying to figure this out - to no avail. It appears itā€™s a problem even with a completely new project and just a single scene with 1 text, 1 string table key. The localization doesnā€™t get picked up on ios build. (unrelated to loadSceneAsync)

I can confirm that the SelectedLocaleAsync picks up a locale: Chinese (Simplified) (zh-Hans). But the error is seen in xcode: Please assign a Font Asset to this Text (TMP) game object. I think, as a result, nothing is picked up, and neither the English nor Chinese text is not picked up. Addressables: 1.19.17, Localization: 1.2.1, Unity 2023.3.27f1:

Itā€™s really weird. It works with the sample ā€œLanguage Selection UGUIā€, also with just 1 text string. I checked file by file (addressables settings, localization settings, fonts, localization tables, scene control), and even the addressables, localization version. But the same setup dosenā€™t work with a completely new project.

Thereā€™s literally nothing much to set up: localization locales (selector, identifier), string table, scene control, creating TMP font asset, adding it in the Chinese active locale. (did exactly the same in both the sample repo and a new repo). Confused :confused:

Giving up for nowā€¦ and wondering why no one has had this issue. I created another bug report (Case 1419539) because itā€™s a different description than the earlier one.

Hi Karl, I was wondering if there might be any workaround, I am unable to get any translation at all working, even if itā€™s just 1 string and nothing else in the entire code. The error was also replicated by QA.

Unfortunately, I have some client pilots upcoming, and I donā€™t any workaround for this.

Bug is here https://unity3d.atlassian.net/servicedesk/customer/portal/2/IN-2140

Hmm. I dont seem to have permission to view your bug report (IN-2140). We are in the process of changing bug tracking systems so it could be that. Ill ask them. I was able to look at 1419539.

I dont see any problems with 1419539. I dont have access to an iOS device to test but I could use the device simulator, does the error reproduce for you when using the xcode device simulator?

Hi Karl thanks for your reply. I managed to replicate it on simulator.

I compressed a folder with the assets, project settings, user settings here
https://drive.google.com/file/d/1q6_mQqrsRDV9B1FI0IlISukdlkfqwJvo/view?usp=sharing

Its stuck at the ā€˜Noneā€™ locale and not even moving to the default english. The phone on this screenshot is setup on Traditional Chinese.

Screenshot in editor

Ah thanks, ill try and take a look tomorrow.

Hey! So after spending some time I can now say this is indeed a Localization package bug.
The GameObjectLocalizer works by applying changes to the target object using JSON. When applying changes to a Unity Object reference we need to apply the reference by its instance id.
E.G if the object has id 3276 then the font json would look like:

ā€œm_fontAssetā€ : {
ā€œinstanceIDā€ : 3276
}

The problem is that in earlier versions of Unity (before 2022.2) this property name was actually different in the player and would not work, instead we needed to use ā€œ.m_FileIDā€ in the player, not ā€œinstanceIDā€. I reported this and it was subsequently fixed in 2022.2. We added a workaround:

#if UNITY_EDITOR || UNITY_2022_2_OR_NEWER
const string instanceIdField = ".instanceID";
#else
const string instanceIdField = ".m_FileID";
#endif

However, this was only applied to localized assets(assets in an Asset table), not those that were local(using a UnityObjectProperty). It looks like we had hardcoded ā€œ.instanceIDā€ for local objects.
The reason QA thought it was fixed in the latest release was down to this fix in 2022.2.

Iā€™ll get it fixed in the package for the next release, thanks for your help.

For now you can work around this by not using local assets, use assets in Asset tables instead. This means you need to create an empty asset table and assign it to the Asset Table field in the Scene Controls. Now changes will be stored in the asset table instead of the component. Localized Property Variants | Localization | 1.3.2
You will need to remove and recreate the existing variants you have.

Hi there sorry, i canā€™t find out how to create an asset table? could you point me in the right direction?

Glad I was able to help! Altho Iā€™m wondering why others did not face this problem

Itā€™s the same as creating a string table but you choose the asset table option. https://docs.unity3d.com/Packages/com.unity.localization@1.3/manual/QuickStartGuideWithVariants.html#asset-localization

It works on asset table :slight_smile: Although Iā€™m quite unclearā€¦ if it works on asset table, why would I then use string table?

Assets go into the asset tables and the strings go into the string tables. So you need both.
We are working on changes in 2.0 so there will be 1 universal table type so in the future it can just be 1 table but thatā€™s far away now.

I still canā€™t get it to work properly :confused: Neither the traditional or simplified Chinese characters seems to populate correctly, even when using Assets. The characters donā€™t even show squares, just missing characters.

Do you have any tips? I did try a completely new project with 2021 version instead. Though it looks like it works thereā€¦ Should I try with an updated unity version?


Those squares indicate that the font is missing the character. If its working in 1 version but not the other then that does seem to indicate thereā€™s a bug but it may have been fixed in the newer versions. Feel free to file a bug report so we can look into it.

hi, is this issue fixed?
I canā€™t access https://issuetracker.unity3d.com/isā€¦ayed-in-the-play-mode-when-using-localization