I’m trying to scrape the existing string database for all keys, as I’m trying to check if we have any stranded keys. So any that aren’t used in a scene, prefab or scriptable object.
I’m trying to implement a menu method that does so, and I’m struggling getting the string database to work in the static method.
private static async Task<Dictionary<long, string>> GetDBLocIds()
{
Dictionary<long, string> used = new Dictionary<long, string>();
/*
var selectTask = LocalizationSettings.Instance.GetSelectedLocaleAsync();
await selectTask.Task;
var locales = LocalizationSettings.Instance.GetAvailableLocales();
if (locales.Locales.Count == 0)
{
Debug.LogError("no locales found");
return used;
}
*/
var async = LocalizationSettings.StringDatabase.GetTableAsync(LocalizationSettings.StringDatabase.DefaultTable);
while (!async.IsDone)
await async.Task;
foreach (StringTableEntry entry in async.Task.Result.Values)
used.Add(entry.KeyId, entry.LocalizedValue);
return used;
}
When this runs, the result of getting the table is null, and I’m not sure why.