Using Localization inside AssetBundle Scene

Hello guys,
I am creating Content-Scenes as Asset Bundles in a separate Unity-Project (Project A) and we started using the Unity Localization for handling localization inside the AB.
The AB gets loaded into another project (Project B) as a Scene and gets “played” there. Unfortunately I’ve realized that the Localization does not work after loading the AB - The Tables are not available.

9108205--1262971--upload_2023-6-27_16-2-27.png

This is a screenshot of the inspector of the loaded AssetBundle. As you can see the Table Collection is empty.
I currently cannot wrap my head around how to approach this. From my understanding when im trying to access the Localization via LocalizationSettings it will get the LocalizationSettings of my Project-B which loads the AB but not the LocalizationSettings in the AB itself (from Project A).
So I need my Localization Tables (String, Asset) written into the AB itself and the AB should also only use the Localization from the AB.
If there is anyone who could point me to the right direction would be greatly appreciated.

Best regards,
Phil

The localization system uses Addressables, if you are trying to access the data from another project then you need to make sure you provide all the data it requires.
https://docs.unity3d.com/Packages/com.unity.addressables@1.21/manual/MultiProject.html

Let’s say I create addressables out of my secondary project and import the addressables (with the String / Asset Tables from the Localization) into my primary Project. To me it’s still unclear how my AB will use the String / Asset Tables inside the Addressable Catalog while I try to call it via LocalizationSettings. Do I need to announce the Tables to the Localization in the Primary Project?

The string table and entry information will be stored in the components. You won’t be able to see the information in the inspector because the assets are in a different project but you will be able to load them at runtime providing the addressables data is included.

Hello Karl, thanks for your reply.
I’ve set up my Adressables inside the AB to be packed within the AB. Therefore from my understanding the addressable data (including the Localization tables) should be available. How would I load and assign the Tables to the Localization in the Viewer Project so that my AssetBundle can be localized? Since the LocalizeStringEvent-Component is empty, do I need to re-initialize them at runtime after loading the AssetBundle?

We don’t support authoring in the editor when the localization data is in another project. So you won’t be able to use the editors to set strings, you can still assign them, via script and they will work providing you set up the project to load the localization data from the other project. If you examine them in the inspector you will not get any useful information, it can not resolve the names or show the data as its not in the project. That doesn’t mean it wont work at runtime though.
In the screenshot you can see it does have the table guid assigned, so when you enter playmode and are using addressables then it should work.
If you are doing this in the editor then make sure the addressables play mode is set to use excisting build.

Hello Karl,
I don’t need to author the localization data once the Asset Bundle is built. I also don’t need to have information shown in the inspector, since in the end its a built Windows Application. I see that it is missing a Table Collection with a certain GUID. So what I think needs to be done is to assign the Table Collection to the Localization Settings at runtime? Do I have to Load the Addressables from the AssetBundle first and then get the Table Collection out of that? I’ve set the Play Mode in our Viewer Project (which loads the AssetBundle as a Scene) to use existing Build but still the TableCollection is missing.

The warning about the missing table GUID is just an editor issue because the localization data is not in the project.
When you run the game it will request the table with that GUID from addressables and then it should then be able to find it from the other projects’ data, providing the table with that GUID exists in the data.
You should only need to add the built addressable data from the project that contains the localization assets for it to work
https://docs.unity3d.com/Packages/com.unity.addressables@1.21/manual/MultiProject.html

So:

  1. Build Addressables for the project with localization
  2. In the other project link against that data via addressables
  3. It should now show the localized values. If you get some errors then please post them, the warnings in the previous screenshot can be ignored. The order things are done should not matter.

Hello Karl,
I’ve managed to make it work by loading the Addressable Catalog before loading the Asset Bundle.

After a while I’m now encountering the following issue:

I’m not able to load the catalog anymore. Also every time I click into the addressable group window this error appears - I see no more addressable groups or any addressable at all until i restart the Editor. I’m using Addressables 1.20.5 in both projects aswell as Localization 1.4.3.

In my Viewing project the following error appears:

I’ve tried updating the Addressable package to no avail. It looks like the Localization Addressable package (which I believe is created within the Localization System) is buggy or somehow erroneous.

Best regards,
Phil

Could you please file a bug report so we can investigate?

Hello Karl,
I’ve managed to get the localization package running again by reimporting the whole project.
After loading the localization via the addressable catalog everything seemed to look fine until I tried changing the language. For some reason my second locale (DE) is not detected.
In Project A I have a Localization Settings with Locale DE and EN. In Project B i also have DE and EN locales in my settings.
When I start Project A my Settings look like this:

When I’m loading my AB-Scene from Project B (via Content Catalog) for reasons unknown to me the German locale identifier (DE) changes to EN in the runtime. If I manually change the identifier back to DE (in the runtime) the missing locale is detected and language changing works fine.

This is my default group inside Project B where the localization stuff resides:

Should I have the locales and Localization Settings from Project B in my Catalog? If so, do I need to manually load in the localization settings in project A?

Best regards,
Phil

It sounds like you may be loading the same locales multiple times if they are in both projects. You should only need the localization settings and locales in the 1 project, you should not need them in both. Try removing them and see if it works.

Hi @karl_jones ,
I am doing the same thing and I am able to load scene from Addressable built from sub project.
But the localization is not working. It is complaining about missing Table Collection.
This is what my subproject settings looks



Nothing stands out. Are you following the multi-project process? https://docs.unity3d.com/Packages/com.unity.addressables@1.21/manual/MultiProject.html
What does the log file say?

I am using this code to load Addressable catalog and then load scene:

AsyncOperationHandle<IResourceLocator> handle = Addressables.LoadContentCatalogAsync($"{Application.dataPath}/../Games/Arcadia/catalog_v1.json", true);
yield return handle;

yield return Addressables.LoadSceneAsync("Arcadia");

Yes I am following the MultiProject setup.
Which log file are you talking about?

I can share simple test project if required.

Yes a test project would help.

Hi this is the simple test project.
It has two unity projects MainProject and ProjectA.
ProjectA is inside submodules folder in MainProject folder.
MainProject has MainScene with a button to launch ProjectA.
In ProjectA I have created ProjectA Addressable profile to export addressable to a particular folder.
You will have to update ProjectA profile variable to point to correct location.

9577456–1355776–MainProject.zip (1.19 MB)

1 Like

Hi,
I took a quick look at the project but I just wanted to check something.
Are you having the issues in the editor or player?
If its the editor you need to make sure you have “Use Existing Build” set as the addressables play mode, we dont support multi projects in the other modes.