Class LocalizationEditorSettings
Editor interface for modifying Localization settings and Localization based Addressables properties.
Inheritance
LocalizationEditorSettings
Syntax
public class LocalizationEditorSettings
Properties
ActiveLocalizationSettings
The LocalizationSettings used for this project.
Declaration
public static LocalizationSettings ActiveLocalizationSettings { get; set; }
Property Value
ActiveLocalizationSettingsInternal
Declaration
protected virtual LocalizationSettings ActiveLocalizationSettingsInternal { get; set; }
Property Value
During play mode, in the editor a menu can be shown to allow for quickly changing the SelectedLocale.
Declaration
public static bool ShowLocaleMenuInGameView { get; set; }
Property Value
Methods
AddAssetToTable(AssetTable, UInt32, 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 static void AddAssetToTable(AssetTable table, uint keyId, Object asset, bool createUndo = false)
Parameters
Type |
Name |
Description |
AssetTable |
table |
|
UInt32 |
keyId |
|
UnityEngine.Object |
asset |
|
Boolean |
createUndo |
Used to indicate if an Undo operation should be created.
|
AddAssetToTableInternal(AssetTable, UInt32, Object, Boolean)
Declaration
protected virtual void AddAssetToTableInternal(AssetTable table, uint keyId, Object asset, bool createUndo)
Parameters
Exceptions
AddLocale(Locale, Boolean)
Add the Locale to the Addressables system, so that it can be used by the Localization system during runtime.
Declaration
public static void AddLocale(Locale locale, bool createUndo)
Parameters
Type |
Name |
Description |
Locale |
locale |
The Locale to add to Addressables so that it can be used by the Localization system.
|
Boolean |
createUndo |
Used to indicate if an Undo operation should be created.
|
AddLocaleInternal(Locale, Boolean)
Declaration
protected virtual void AddLocaleInternal(Locale locale, bool createUndo)
Parameters
AddOrUpdateTable(LocalizedTable, Boolean)
Add or update the Addressables data for the table.
Ensures the table is in the correct group and has all the required labels.
Declaration
public static void AddOrUpdateTable(LocalizedTable table, bool createUndo)
Parameters
Type |
Name |
Description |
LocalizedTable |
table |
|
Boolean |
createUndo |
Used to indicate if an Undo operation should be created.
|
AddOrUpdateTableInternal(LocalizedTable, Boolean)
Update the Addressables data for the table.
Declaration
protected virtual void AddOrUpdateTableInternal(LocalizedTable table, bool createUndo)
Parameters
Type |
Name |
Description |
LocalizedTable |
table |
|
Boolean |
createUndo |
Used to indicate if an Undo operation should be created.
|
CreateAssetTable(Locale, KeyDatabase, Type, String)
Create a new AssetTable asset. This will create the table and ensure that the table is also added to the Addressables.
Declaration
public static LocalizedTable CreateAssetTable(Locale selectedLocales, KeyDatabase keyDatabase, Type tableType, string assetPath)
Parameters
Type |
Name |
Description |
Locale |
selectedLocales |
The locale the table should be created for.
|
KeyDatabase |
keyDatabase |
|
Type |
tableType |
The type of table to create. Must inherit from LocalizedTable.
|
String |
assetPath |
The path to save the asset to.
|
Returns
CreateAssetTableCollection(IList<Locale>, String, Type, String)
Creates an AssetTable of type tableType
for each of the Locales provided in selectedLocales
.
Declaration
public static List<LocalizedTable> CreateAssetTableCollection(IList<Locale> selectedLocales, string tableName, Type tableType, string assetDirectory)
Parameters
Type |
Name |
Description |
IList<Locale> |
selectedLocales |
The locales to use for generating the Tables.
|
String |
tableName |
The table name to be used for all tables.
|
Type |
tableType |
The type of table to create. Must inherit from LocalizedTable.
|
String |
assetDirectory |
The directory to save all the generated asset files to.
|
Returns
CreateAssetTableCollectionInternal(IList<Locale>, String, Type, String, Boolean, Boolean)
Create multiple tables using the provided arguments.
Declaration
protected virtual List<LocalizedTable> CreateAssetTableCollectionInternal(IList<Locale> selectedLocales, string tableName, Type tableType, string assetDirectory, bool showProgressBar, bool showInTablesWindow)
Parameters
Type |
Name |
Description |
IList<Locale> |
selectedLocales |
List of Locale, a table will be created for each one.
|
String |
tableName |
The name of the table that will be applied to all tables.
|
Type |
tableType |
The type of table, must derive from LocalizedTable.
|
String |
assetDirectory |
Directory where the created tables will be saved, must be in the project Assets folder.
|
Boolean |
showProgressBar |
Should a progress bar be shown during the creation?
|
Boolean |
showInTablesWindow |
Should the Asset Tables Window be opened with these new tables selected?
|
Returns
CreateAssetTableInternal(Locale, KeyDatabase, Type, String)
Creates a table using provided arguments.
Declaration
protected virtual LocalizedTable CreateAssetTableInternal(Locale selectedLocales, KeyDatabase keyDatabase, Type tableType, string assetPath)
Parameters
Type |
Name |
Description |
Locale |
selectedLocales |
The Locale the table represents.
|
KeyDatabase |
keyDatabase |
|
Type |
tableType |
The type of table, must derive from LocalizedTable.
|
String |
assetPath |
Where to save the asset, must be inside of the project Assets folder.
|
Returns
FindSimilarKey<TTable>(String)
Returns the AssetTableCollection that contains a table entry with the closest match to the provided text.
Uses the Levenshtein distance method.
Declaration
public static (AssetTableCollection collection, KeyDatabase.KeyDatabaseEntry entry, int matchDistance)FindSimilarKey<TTable>(string keyName)
where TTable : LocalizedTable
Parameters
Type |
Name |
Description |
String |
keyName |
|
Returns
Type Parameters
FindSimilarKeyInternal<TTable>(String)
Declaration
protected virtual (AssetTableCollection collection, KeyDatabase.KeyDatabaseEntry entry, int matchDistance)FindSimilarKeyInternal<TTable>(string keyName)
where TTable : LocalizedTable
Parameters
Type |
Name |
Description |
String |
keyName |
|
Returns
Type Parameters
FindUniqueAssetAddress(String)
Tries to find a unique address for the asset to be stored in Addressables.
Declaration
protected virtual string FindUniqueAssetAddress(string address)
Parameters
Type |
Name |
Description |
String |
address |
|
Returns
GetAssetTables(Type)
Returns all asset tables in the project of type tableType.
Declaration
public static List<AddressableAssetEntry> GetAssetTables(Type tableType)
Parameters
Type |
Name |
Description |
Type |
tableType |
|
Returns
Type |
Description |
List<AddressableAssetEntry> |
|
GetAssetTables<TLocalizedTable>()
Returns all asset tables in the project of type TLocalizedTable.
Declaration
public static List<AddressableAssetEntry> GetAssetTables<TLocalizedTable>()
where TLocalizedTable : LocalizedTable
Returns
Type |
Description |
List<AddressableAssetEntry> |
|
Type Parameters
Name |
Description |
TLocalizedTable |
|
GetAssetTablesCollection(Type)
Returns all asset tables in the project sorted by type and table name.
Declaration
public static ReadOnlyCollection<AssetTableCollection> GetAssetTablesCollection(Type tableType)
Parameters
Type |
Name |
Description |
Type |
tableType |
|
Returns
GetAssetTablesCollection<TLocalizedTable>()
Returns all asset tables in the project sorted by type and table name.
Declaration
public static ReadOnlyCollection<AssetTableCollection> GetAssetTablesCollection<TLocalizedTable>()
where TLocalizedTable : LocalizedTable
Returns
Type Parameters
Name |
Description |
TLocalizedTable |
|
GetAssetTablesCollectionInternal(Type)
Declaration
protected virtual ReadOnlyCollection<AssetTableCollection> GetAssetTablesCollectionInternal(Type tableType)
Parameters
Type |
Name |
Description |
Type |
tableType |
|
Returns
GetAssetTablesInternal(Type)
Declaration
protected virtual List<AddressableAssetEntry> GetAssetTablesInternal(Type tableType)
Parameters
Type |
Name |
Description |
Type |
tableType |
|
Returns
Type |
Description |
List<AddressableAssetEntry> |
|
GetGroup(AddressableAssetSettings, String, Boolean, Boolean)
Returns the Addressables group with the matching name or creates a new one, if one could not be found.
Declaration
protected virtual AddressableAssetGroup GetGroup(AddressableAssetSettings settings, string groupName, bool create, bool createUndo)
Parameters
Type |
Name |
Description |
AddressableAssetSettings |
settings |
|
String |
groupName |
|
Boolean |
create |
|
Boolean |
createUndo |
Used to indicate if an Undo operation should be created.
|
Returns
Type |
Description |
AddressableAssetGroup |
|
GetLocale(String)
Returns the locale for the code if it exists in the project.
Declaration
public static Locale GetLocale(string code)
Parameters
Type |
Name |
Description |
String |
code |
|
Returns
GetLocaleInternal(String)
Declaration
protected virtual Locale GetLocaleInternal(string code)
Parameters
Type |
Name |
Description |
String |
code |
|
Returns
GetLocales()
Returns all locales that are part of the Addressables system.
Declaration
public static ReadOnlyCollection<Locale> GetLocales()
Returns
GetLocalesInternal()
Declaration
protected virtual ReadOnlyCollection<Locale> GetLocalesInternal()
Returns
GetPreloadTableFlag(LocalizedTable)
Returns true if the table is marked for preloading.
Declaration
public static bool GetPreloadTableFlag(LocalizedTable table)
Parameters
Returns
GetPreloadTableFlagInternal(LocalizedTable)
Declaration
protected virtual bool GetPreloadTableFlagInternal(LocalizedTable table)
Parameters
Returns
Exceptions
GetTableGroupName(Type)
Returns the name of the Addressables group that the table typse should be stored in.
Declaration
protected virtual string GetTableGroupName(Type tableType)
Parameters
Type |
Name |
Description |
Type |
tableType |
|
Returns
RemoveAssetFromTable(AssetTable, UInt32, Object, Boolean)
Remove the asset mapping from the table and also cleanup the Addressables if necessary.
Declaration
public static void RemoveAssetFromTable(AssetTable table, uint keyId, Object asset, bool createUndo = false)
Parameters
RemoveAssetFromTableInternal(AssetTable, UInt32, String, Boolean)
Declaration
protected virtual void RemoveAssetFromTableInternal(AssetTable table, uint keyId, string assetGuid, bool createUndo)
Parameters
RemoveAssetFromTableInternal<TObject>(AssetTable, UInt32, TObject, Boolean)
Declaration
protected virtual void RemoveAssetFromTableInternal<TObject>(AssetTable table, uint keyId, TObject asset, bool createUndo)
where TObject : Object
Parameters
Type Parameters
RemoveLocale(Locale, Boolean)
Removes the locale from the Addressables system.
Declaration
public static void RemoveLocale(Locale locale, bool createUndo)
Parameters
Type |
Name |
Description |
Locale |
locale |
The Locale to remove from Addressables so that it is no longer used by the Localization system.
|
Boolean |
createUndo |
Used to indicate if an Undo operation should be created.
|
RemoveLocaleInternal(Locale, Boolean)
Declaration
protected virtual void RemoveLocaleInternal(Locale locale, bool createUndo)
Parameters
RemoveTable(LocalizedTable, Boolean)
Remove the table from Addressables and any associated assets if they are not used elsewhere.
Declaration
public static void RemoveTable(LocalizedTable table, bool createUndo = false)
Parameters
Type |
Name |
Description |
LocalizedTable |
table |
|
Boolean |
createUndo |
Used to indicate if an Undo operation should be created.
|
RemoveTableInternal(LocalizedTable, Boolean)
Declaration
protected virtual void RemoveTableInternal(LocalizedTable table, bool createUndo)
Parameters
SetPreloadTableFlag(LocalizedTable, Boolean, Boolean)
Adds/Removes the preload flag for the table.
Declaration
public static void SetPreloadTableFlag(LocalizedTable table, bool preload, bool createUndo = false)
Parameters
SetPreloadTableInternal(LocalizedTable, Boolean, Boolean)
Declaration
protected virtual void SetPreloadTableInternal(LocalizedTable table, bool preload, bool createUndo = false)
Parameters
Exceptions
UpdateAssetGroup(AddressableAssetSettings, AddressableAssetEntry, Boolean)
Updates the group the asset should belong to.
If an asset is used by more than 1 Locale then it 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.
|