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
DefaultAddressablesGroupName
The Addressables group that the tables will be added to for this collection.
Declaration
protected abstract string DefaultAddressablesGroupName { get; }
Property Value
Type | Description |
---|---|
String |
DefaultGroupName
Declaration
protected abstract string DefaultGroupName { get; }
Property Value
Type | Description |
---|---|
String |
Extensions
Extensions attached to the collection. Extensions can be used for attaching 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
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 that can be used 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 are only loaded when required and not when the collection is loaded.
Declaration
public ReadOnlyCollection<LazyLoadReference<LocalizationTable>> Tables { get; }
Property Value
Type | Description |
---|---|
ReadOnlyCollection<LazyLoadReference<LocalizationTable>> |
TableType
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? |
CanAddTable(LocalizationTable)
Can this table be added to the collection? Checks if the table is already in the collection or if a table with the same LocaleIdentifier is in the collection.
Declaration
protected virtual bool CanAddTable(LocalizationTable table)
Parameters
Type | Name | Description |
---|---|---|
LocalizationTable | table | The table to add. |
Returns
Type | Description |
---|---|
Boolean |
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>)
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 |
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. |
OnAfterDeserialize()
Declaration
public void OnAfterDeserialize()
Implements
OnBeforeSerialize()
Declaration
public void OnBeforeSerialize()
Implements
OnEnable()
Declaration
protected virtual void OnEnable()
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()
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 |
ToString()
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
String |