Class AssetTableCollection
Contains information on all the tables associated with a table collection name and type.
Inherited Members
Namespace: UnityEditor.Localization
Syntax
public class AssetTableCollection : LocalizationTableCollection, ISerializationCallbackReceiver
Properties
AssetTables
A helper property which is the contents of Tables loaded and cast to AssetTable.
Declaration
public virtual ReadOnlyCollection<AssetTable> AssetTables { get; }
Property Value
Type | Description |
---|---|
ReadOnlyCollection<AssetTable> |
DefaultGroupName
The default value to use for Group.
Declaration
protected override string DefaultGroupName { get; }
Property Value
Type | Description |
---|---|
String |
Overrides
RequiredExtensionAttribute
The required attribute for an extension to be added to this collection through the Editor.
Declaration
protected override Type RequiredExtensionAttribute { get; }
Property Value
Type | Description |
---|---|
Type |
Overrides
TableType
The type of table stored in the collection.
Declaration
protected override Type TableType { get; }
Property Value
Type | Description |
---|---|
Type |
Overrides
Methods
AddAssetToTable(LocaleIdentifier, TableEntryReference, Object, Boolean)
Add a localized asset to the asset table that matches the LocaleIdentifier. This function ensures the localization system adds the asset to the Addressables system and sets the asset up for use.
Declaration
public void AddAssetToTable(LocaleIdentifier localeIdentifier, TableEntryReference entryReference, Object asset, bool createUndo = false)
Parameters
Type | Name | Description |
---|---|---|
LocaleIdentifier | localeIdentifier | The table to add the asset to, if a table with the id does not exist a new one will be created. |
TableEntryReference | entryReference | The table entry Key or Key Id. |
Object | asset | The asset to add. |
Boolean | createUndo | Should an undo operation be created? |
AddAssetToTable(AssetTable, TableEntryReference, Object, Boolean)
Add a localized asset to the asset table. This function will ensure the localization system adds the asset to the Addressables system and sets the asset up for use.
Declaration
public virtual void AddAssetToTable(AssetTable table, TableEntryReference entryReference, Object asset, bool createUndo = false)
Parameters
Type | Name | Description |
---|---|---|
AssetTable | table | The table to add the asset to, must be part of the collection. |
TableEntryReference | entryReference | The table entry Key or Key Id. |
Object | asset | The asset to add. |
Boolean | createUndo | Should an undo operation be created? |
ClearAllEntries()
Removes all the entries from SharedTableData and all Tables that are part of this collection.
Declaration
public override void ClearAllEntries()
Overrides
GetEntryAssetType(TableEntryReference)
Returns the expected type for the entry. When an asset is first added to an entry, the type is recorded so that the Editor can ensure all subsequent assets that are added are compatible.
Declaration
public Type GetEntryAssetType(TableEntryReference tableEntry)
Parameters
Type | Name | Description |
---|---|---|
TableEntryReference | tableEntry | The entry to return the asset type for. |
Returns
Type | Description |
---|---|
Type | The expected asset type or typeof(Object) if unknown. |
GetRowEnumerator()
Returns an enumerator that can be used to step through each key and its localized values, such as in a foreach loop. Internally SharedTableData and AssetTable's are separate assets with their own internal list of values. This means that when iterating through each key a lookup must be made in each table in order to retrieve the localized value, this can become slow when dealing with a large number of tables and entries. GetRowEnumerator improves this process by first sorting the multiple internal lists and then stepping through each conceptual row at a time. It handles missing keys and table entries and provides a more efficient and faster way to iterate through the tables.
Declaration
public IEnumerable<LocalizationTableCollection.Row<AssetTableEntry>> GetRowEnumerator()
Returns
Type | Description |
---|---|
IEnumerable<LocalizationTableCollection.Row<AssetTableEntry>> |
RemoveAssetFromTable(AssetTable, TableEntryReference, Boolean)
Remove the asset mapping from the table entry and also cleans up the Addressables if necessary.
Declaration
public void RemoveAssetFromTable(AssetTable table, TableEntryReference entryReference, bool createUndo = false)
Parameters
Type | Name | Description |
---|---|---|
AssetTable | table | |
TableEntryReference | entryReference | |
Boolean | createUndo |
RemoveEntry(TableEntryReference)
Removes the entry from the SharedTableData and all tables that are part of this collection.
Declaration
public override void RemoveEntry(TableEntryReference entryReference)
Parameters
Type | Name | Description |
---|---|---|
TableEntryReference | entryReference |
Overrides
RemoveTableFromAddressables(LocalizationTable, Boolean)
Remove the table from the Addressables system.
Declaration
protected override void RemoveTableFromAddressables(LocalizationTable table, bool createUndo)
Parameters
Type | Name | Description |
---|---|---|
LocalizationTable | table | The table to remove. |
Boolean | createUndo | Should an Undo operation be recorded? |
Overrides
SetEntryAssetType(TableEntryReference, Type)
The type of asset that is expected by this entry. By default this is determined by the first asset that is added in the Editor however this can be used to override it so it always expects this asset type instead of reverting back to Object when the last asset is removed.
Declaration
public void SetEntryAssetType(TableEntryReference tableEntry, Type assetType)
Parameters
Type | Name | Description |
---|---|---|
TableEntryReference | tableEntry | The entry to set the asset type for. |
Type | assetType | The asset type to expect for this entry. To reset the override and allow the Editor to control the type pass null or |
UpdateAssetGroup(AddressableAssetSettings, AddressableAssetEntry, Boolean)
Updates the group the asset should belong to. Assets will be stored in groups for the Locale they are used by unless they are used by more than 1 Locale, then they will be moved to the shared group.
Declaration
protected virtual void UpdateAssetGroup(AddressableAssetSettings settings, AddressableAssetEntry assetEntry, bool createUndo)
Parameters
Type | Name | Description |
---|---|---|
AddressableAssetSettings | settings | |
AddressableAssetEntry | assetEntry | |
Boolean | createUndo | Used to indicate if an Undo operation should be created. |