Is Asset Table can only be used for Images?

Hello,
Can I use Asset Table to record different prefabs? Like how we can record different images? I tried to follow the instructions from here.
https://docs.unity3d.com/Packages/com.unity.localization@1.3/manual/QuickStartGuideWithVariants.html#asset-localization

So it’s recording the prefabs correctly, which I can see in (Window > Asset Management > Localization Tables)

But it’s not loading in play mode.

Yes it should work for Prefabs. How are you trying to load them? Can you share the code? You may just need to instantiate them.

1 Like

I am not loading it from script.

this is the variable
public Dialogs dialogs;

which i am filling from editor for different localizations. And it’s turning green in editor.
I can see it filled in (Window > Asset Management > Localization Tables)

After that when I am hitting play the variable showing none in editor.
In tutorial page images loading by itself? Then this prefab should be loaded by itself?

The prefab should be loaded but it wont be instantiated into the scene. You need to do that in script.
E.G see
LocalizedPrefabExample
https://docs.unity3d.com/Packages/com.unity.localization@1.3/api/UnityEngine.Localization.LocalizedAsset-1.html

1 Like

Thank you, now it’s working.
What I was doing wrong is I am trying to record scripts, which are attached to the prefabs.
Now I tried to record prefabs and it’s working. I didn’t instantiate anything.
But there is one thing:
Prefab loading only after 0.5 seconds. If I am trying to access the prefab in 0.4 second or before it’s showing null reference exception.
There is no problem in my case but why it’s loading after 0.5 seconds?

They load asynchronously in the background by default so wont be immediately available.
You can force them by enabling the WaitForCompletion flag on the LocalizedAsset.

1 Like

Hello,
Where I can find “WaitForCompletion” option? Because I can’t find this option anywhere.
I enable an other option Initialize Synchronously in Project settings > Localization. Are you talking about this?

I tried different approches, like

yield return new WaitUntil(() => dialogsPrefab != null); // Wait untill this variable filled by localization

I enabled Initialize Synchronously option.

There is absolutely no error inside the Editor and everything is working fine, but in Windows Standalone build above prefab never loading by Localization.

Are you using a LocalizedAsset?
https://docs.unity3d.com/Packages/com.unity.localization@1.3/api/UnityEngine.Localization.LocalizedAsset-1.html

That has an option in the inspector.
If you are calling LocalizationSettings.AssetDatabase.LoadAsset then it will call WaitForCompletion automatically.

1 Like

I am not using LocalizationSettings.AssetDatabase.LoadAsset
But how to use it?
I am very beginner to scripting even after years, and I am having trouble understanding documentation. Sorry for the troubles :sweat_smile:
This is my script:

public GameObject dialogsPrefab; // I recorded multiple localized prefabs using editor

void Start()
    {
        if(SceneManager.GetActiveScene().name == "Tutorial")
        {
            StartCoroutine(Initiate());
        }
    }

    IEnumerator Initiate()
    {
        // dialogPrefab must be loaded here before reaching below lines

        dialogs = dialogsPrefab.GetComponent<Dialogs>();
    }

What does your dialogs script look like?

1 Like
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using TMPro;

public class Dialogs : MonoBehaviour
{
    [System.Serializable]
    public class First
    {
        [TextArea(minLines: 5, maxLines: 10)]
        public List<string> sentences;
    }
    public List<First> nestedList = new List<First>();
    public int[] dialogWaitTimes;
}

8181659--1065707--Capture.JPG

Can you change it from List to List?
Although I think I may be misunderstanding the problem. What is it you are trying to solve? The prefab loading too slowly? How do you load the prefab?

1 Like

Yes I can change. I just hope I know this before. dialogsPrefab not loading problem is fixed after switching from .NET Standard 2.0 to .NET 4.x. But now I can also switch to List if there is more problem in future. Thank you so much :slight_smile:

with .NET Standalone 2.0 dialogsPrefab was not loading at all. But with .NET 4.x it’s fixed.

1 Like

That’s strange, I don’t see how the .Net version would cause this. :face_with_spiral_eyes:

1 Like

I am very sure about this. First I was using 4.x it was working, I switched to 2.0 not working, then I finally switched to 4.x and now it’s working.

1 Like

Hello @karl_jones
I want remove asset table and all recorded data. I deleted all asset table files, I even changed variable name in the script but it’s not letting go Localized property. It’s keep turning green.

Does the gameobject have a gameobject localizer component attached? You need to remove that.

1 Like

Yes, thank you so much. I was dumb, looking for this component in wrong gameobjects. Now it’s fixed.

1 Like