Class LocalizationTableCollection
Editor interface to a collection of tables which all share the same SharedTableData.
Inherited Members
Namespace: UnityEditor.Localization
Syntax
public abstract class LocalizationTableCollection : ScriptableObject, ISerializationCallbackReceiver
Properties
DefaultGroupName
The default value to use for Group.
Declaration
protected abstract string DefaultGroupName { get; }
Property Value
Type | Description |
---|---|
String |
Extensions
Extensions attached to the collection. Extensions can be used to attach additional data or functionality to a collection.
Declaration
public ReadOnlyCollection<CollectionExtension> Extensions { get; }
Property Value
Type | Description |
---|---|
ReadOnlyCollection<CollectionExtension> |
Group
Collections can be added to groups which will be used when showing the list of collections in the Localization Window.
For example all collections with the Group "UI" would be shown under a UI menu in the Selected Table Collection
field.
Declaration
public string Group { get; set; }
Property Value
Type | Description |
---|---|
String |
RequiredExtensionAttribute
The required attribute for an extension to be added to this collection through the Editor.
Declaration
protected abstract Type RequiredExtensionAttribute { get; }
Property Value
Type | Description |
---|---|
Type |
SharedData
The SharedTableData that is used by all tables in this collection.
Declaration
public virtual SharedTableData SharedData { get; }
Property Value
Type | Description |
---|---|
SharedTableData |
TableCollectionName
The name of this collection of Tables.
Declaration
public string TableCollectionName { get; set; }
Property Value
Type | Description |
---|---|
String |
TableCollectionNameReference
Reference to use to refer to this table collection.
Declaration
public TableReference TableCollectionNameReference { get; }
Property Value
Type | Description |
---|---|
TableReference |
Tables
All tables that are part of this collection. Tables are stored as LazyLoadReferences so that they only load when required and not when the collection loads.
Declaration
public ReadOnlyCollection<LazyLoadReference<LocalizationTable>> Tables { get; }
Property Value
Type | Description |
---|---|
ReadOnlyCollection<LazyLoadReference<LocalizationTable>> |
TableType
The type of table stored in the collection.
Declaration
protected abstract Type TableType { get; }
Property Value
Type | Description |
---|---|
Type |
Methods
AddExtension(CollectionExtension)
Attaches the provided extension to the collection.
Declaration
public void AddExtension(CollectionExtension extension)
Parameters
Type | Name | Description |
---|---|---|
CollectionExtension | extension | The extension to add to the collection. |
Exceptions
Type | Condition |
---|---|
ArgumentException | Thrown if the extension does not have correct attribute. |
AddNewTable(LocaleIdentifier)
Creates a table in the collection.
Declaration
public virtual LocalizationTable AddNewTable(LocaleIdentifier localeIdentifier)
Parameters
Type | Name | Description |
---|---|---|
LocaleIdentifier | localeIdentifier |
Returns
Type | Description |
---|---|
LocalizationTable |
|
AddNewTable(LocaleIdentifier, String)
Creates a table in the collection.
Declaration
public virtual LocalizationTable AddNewTable(LocaleIdentifier localeIdentifier, string path)
Parameters
Type | Name | Description |
---|---|---|
LocaleIdentifier | localeIdentifier | |
String | path |
Returns
Type | Description |
---|---|
LocalizationTable |
|
AddSharedTableDataToAddressables()
Adds SharedData to Addressables.
Declaration
protected virtual void AddSharedTableDataToAddressables()
AddTable(LocalizationTable, Boolean, Boolean)
Adds the table to the collection and updates Addressable assets. The table will not be added if it is not using the same SharedTableData as the collection.
Declaration
public virtual void AddTable(LocalizationTable table, bool createUndo = false, bool postEvent = true)
Parameters
Type | Name | Description |
---|---|---|
LocalizationTable | table | The table to add to the collection. |
Boolean | createUndo | Should an Undo operation be created? |
Boolean | postEvent | Should the TableAddedToCollection event be sent after the table was added? |
AddTableToAddressables(LocalizationTable, Boolean)
Add the table to the Addressable assets system.
Declaration
protected virtual void AddTableToAddressables(LocalizationTable table, bool createUndo)
Parameters
Type | Name | Description |
---|---|---|
LocalizationTable | table | The table to add. |
Boolean | createUndo | Should an Undo operation be recorded? |
ClearAllEntries()
Removes all the entries from SharedTableData and all Tables that are part of this collection.
Declaration
public virtual void ClearAllEntries()
ContainsTable(LocaleIdentifier)
Checks if a table with the same LocaleIdentifier exists in the collection.
Declaration
public bool ContainsTable(LocaleIdentifier localeIdentifier)
Parameters
Type | Name | Description |
---|---|---|
LocaleIdentifier | localeIdentifier | The Id to match against. |
Returns
Type | Description |
---|---|
Boolean |
ContainsTable(LocalizationTable)
Checks if a table with the same instance Id exists in the collection. This check should be fast as a table does not need to be loaded to have its instance Id compared.
Declaration
public bool ContainsTable(LocalizationTable table)
Parameters
Type | Name | Description |
---|---|---|
LocalizationTable | table | The table to look for. |
Returns
Type | Description |
---|---|
Boolean |
GetRowEnumerator<TTable, TEntry>(IEnumerable<TTable>)
Returns an enumerable for stepping through the rows of the collection. Sorted by the SharedData entry Ids.
Declaration
protected static IEnumerable<LocalizationTableCollection.Row<TEntry>> GetRowEnumerator<TTable, TEntry>(IEnumerable<TTable> tables)
where TTable : DetailedLocalizationTable<TEntry> where TEntry : TableEntry
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<TTable> | tables |
Returns
Type | Description |
---|---|
IEnumerable<LocalizationTableCollection.Row<TEntry>> |
Type Parameters
Name | Description |
---|---|
TTable | |
TEntry |
GetRowEnumeratorUnsorted<TTable, TEntry>(IList<TTable>)
Returns an enumerable for stepping through the rows of the collection. Unlike GetRowEnumerator<TTable, TEntry>(IEnumerable<TTable>), the items are not sorted by Id and will be returned in the same order as they are stored in SharedData.
Declaration
protected static IEnumerable<LocalizationTableCollection.Row<TEntry>> GetRowEnumeratorUnsorted<TTable, TEntry>(IList<TTable> tables)
where TTable : DetailedLocalizationTable<TEntry> where TEntry : TableEntry
Parameters
Type | Name | Description |
---|---|---|
IList<TTable> | tables |
Returns
Type | Description |
---|---|
IEnumerable<LocalizationTableCollection.Row<TEntry>> |
Type Parameters
Name | Description |
---|---|
TTable | |
TEntry |
GetTable(LocaleIdentifier)
Returns the table with the matching LocaleIdentifier.
Declaration
public virtual LocalizationTable GetTable(LocaleIdentifier localeIdentifier)
Parameters
Type | Name | Description |
---|---|---|
LocaleIdentifier | localeIdentifier | The locale identifier that the table must have. |
Returns
Type | Description |
---|---|
LocalizationTable | The table with the matching LocaleIdentifier or null if one does not exist in the collection. |
ImportCollectionIntoProject()
Called when the asset is created or imported into a project(via OnPostprocessAllAssets).
Declaration
protected virtual void ImportCollectionIntoProject()
IsPreloadTableFlagSet()
Are the tables in the collection set to preload?
Declaration
public virtual bool IsPreloadTableFlagSet()
Returns
Type | Description |
---|---|
Boolean | True if all tables are set to preload else false. |
RefreshAddressables(Boolean)
Forces Addressables data to be updated for this collection. This will ensure that SharedData and Tables are both part of Addressables and correctly labeled.
Declaration
public void RefreshAddressables(bool createUndo = false)
Parameters
Type | Name | Description |
---|---|---|
Boolean | createUndo |
RemoveCollectionFromProject()
Called to remove the asset from a project, such as when it is about to be deleted.
Declaration
protected virtual void RemoveCollectionFromProject()
RemoveEntry(TableEntryReference)
Removes the entry from the SharedTableData and all tables that are part of this collection.
Declaration
public abstract void RemoveEntry(TableEntryReference entryReference)
Parameters
Type | Name | Description |
---|---|---|
TableEntryReference | entryReference |
RemoveExtension(CollectionExtension)
Removes the extension from Extensions.
Declaration
public void RemoveExtension(CollectionExtension extension)
Parameters
Type | Name | Description |
---|---|---|
CollectionExtension | extension |
RemoveTable(LocalizationTable, Boolean, Boolean)
Removes the table from the collection and updates Addressables assets.
Declaration
public virtual void RemoveTable(LocalizationTable table, bool createUndo = false, bool postEvent = true)
Parameters
Type | Name | Description |
---|---|---|
LocalizationTable | table | |
Boolean | createUndo | |
Boolean | postEvent | Should the TableRemovedFromCollection event be sent after the table has been removed? |
RemoveTableFromAddressables(LocalizationTable, Boolean)
Remove the table from the Addressables system.
Declaration
protected virtual void RemoveTableFromAddressables(LocalizationTable table, bool createUndo)
Parameters
Type | Name | Description |
---|---|---|
LocalizationTable | table | The table to remove. |
Boolean | createUndo | Should an Undo operation be recorded? |
SetPreloadTableFlag(Boolean, Boolean)
Sets the preload flag for all tables in this collection.
Declaration
public virtual void SetPreloadTableFlag(bool preload, bool createUndo = false)
Parameters
Type | Name | Description |
---|---|---|
Boolean | preload | Should the tables be preloaded? True for preloading or false to load on demand. |
Boolean | createUndo | Create an undo point? |
SetTableCollectionName(String, Boolean)
Changes the table collection name. This will change TableCollectionName and update the Addressables data for all tables within the collection.
Declaration
public void SetTableCollectionName(string name, bool createUndo = false)
Parameters
Type | Name | Description |
---|---|---|
String | name | |
Boolean | createUndo |