Method GetAssetTableCollections
GetAssetTableCollections()
Returns all AssetTableCollection assets that are in the project.
Declaration
public static ReadOnlyCollection<AssetTableCollection> GetAssetTableCollections()
Returns
Type | Description |
---|---|
ReadOnlyCollection<AssetTableCollection> |
Examples
This example shows how to print out the contents of all the AssetTableCollection in the project.
[MenuItem("Localization Samples/Print All Asset Table Collection Contents")]
public static void PrintAssetTableCollectionContents()
{
// This example prints out the contents of every Asset Table Collection
var stringBuilder = new StringBuilder();
foreach (var stringTableCollection in LocalizationEditorSettings.GetAssetTableCollections())
{
stringBuilder.AppendLine($"String Table Collection Name: {stringTableCollection.TableCollectionName}");
foreach (var assetTable in stringTableCollection.AssetTables)
{
stringBuilder.AppendLine($"\tTable {assetTable.LocaleIdentifier}");
foreach (var assetTableValue in assetTable.Values)
{
// Load the asset
Object asset = null;
if (!string.IsNullOrEmpty(assetTableValue.Guid))
{
var assetPath = AssetDatabase.GUIDToAssetPath(assetTableValue.Guid);
asset = AssetDatabase.LoadAssetAtPath<Object>(assetPath);
}
stringBuilder.AppendLine($"\t\t{assetTableValue.Key} - {asset}");
if (assetTable.MetadataEntries.Count > 0)
{
foreach (var metadataEntry in assetTable.MetadataEntries)
{
stringBuilder.AppendLine($"\t\t\t{metadataEntry}");
}
}
}
}
}
Debug.Log(stringBuilder.ToString());
}