Class LocalizationEditorSettings | Localization | 0.6.1-preview
docs.unity3d.com
    Show / Hide Table of Contents

    Class LocalizationEditorSettings

    Editor interface for modifying Localization settings and Localization based Addressables properties.

    Inheritance
    Object
    LocalizationEditorSettings
    FakedLocalizationEditorSettings
    Namespace: UnityEditor.Localization
    Syntax
    public class LocalizationEditorSettings

    Properties

    ActiveLocalizationSettings

    The LocalizationSettings used for this project.

    Declaration
    public static LocalizationSettings ActiveLocalizationSettings { get; set; }
    Property Value
    Type Description
    LocalizationSettings
    Remarks

    The activeLocalizationSettings will be available in any player builds and the editor when playing. During a build or entering play mode, the asset will be added to the preloaded assets list. Note: This needs to be an asset.

    ActiveLocalizationSettingsInternal

    Declaration
    protected virtual LocalizationSettings ActiveLocalizationSettingsInternal { get; set; }
    Property Value
    Type Description
    LocalizationSettings

    ShowLocaleMenuInGameView

    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
    Type Description
    Boolean

    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
    Type Name Description
    AssetTable table
    UInt32 keyId
    UnityEngine.Object asset
    Boolean createUndo
    Exceptions
    Type Condition
    ArgumentNullException

    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
    Type Name Description
    Locale locale
    Boolean createUndo

    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, SharedTableData, 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, SharedTableData SharedTableData, Type tableType, string assetPath)
    Parameters
    Type Name Description
    Locale selectedLocales

    The locale the table should be created for.

    SharedTableData SharedTableData
    Type tableType

    The type of table to create. Must inherit from LocalizedTable.

    String assetPath

    The path to save the asset to.

    Returns
    Type Description
    LocalizedTable

    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
    Type Description
    List<LocalizedTable>

    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
    Type Description
    List<LocalizedTable>

    CreateAssetTableInternal(Locale, SharedTableData, Type, String)

    Creates a table using provided arguments.

    Declaration
    protected virtual LocalizedTable CreateAssetTableInternal(Locale selectedLocales, SharedTableData SharedTableData, Type tableType, string assetPath)
    Parameters
    Type Name Description
    Locale selectedLocales

    The Locale the table represents.

    SharedTableData SharedTableData
    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
    Type Description
    LocalizedTable

    Returns the created table.

    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, SharedTableData.SharedTableEntry entry, int matchDistance)FindSimilarKey<TTable>(string keyName)
        where TTable : LocalizedTable
    Parameters
    Type Name Description
    String keyName
    Returns
    Type Description
    ValueTuple<AssetTableCollection, SharedTableData.SharedTableEntry, Int32>
    Type Parameters
    Name Description
    TTable

    FindSimilarKeyInternal<TTable>(String)

    Declaration
    protected virtual (AssetTableCollection collection, SharedTableData.SharedTableEntry entry, int matchDistance)FindSimilarKeyInternal<TTable>(string keyName)
        where TTable : LocalizedTable
    Parameters
    Type Name Description
    String keyName
    Returns
    Type Description
    ValueTuple<AssetTableCollection, SharedTableData.SharedTableEntry, Int32>
    Type Parameters
    Name Description
    TTable

    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
    Type Description
    String

    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
    Type Description
    ReadOnlyCollection<AssetTableCollection>

    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 Description
    ReadOnlyCollection<AssetTableCollection>
    Type Parameters
    Name Description
    TLocalizedTable

    GetAssetTablesCollectionInternal(Type)

    Declaration
    protected virtual ReadOnlyCollection<AssetTableCollection> GetAssetTablesCollectionInternal(Type tableType)
    Parameters
    Type Name Description
    Type tableType
    Returns
    Type Description
    ReadOnlyCollection<AssetTableCollection>

    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
    Type Description
    Locale

    GetLocaleInternal(String)

    Declaration
    protected virtual Locale GetLocaleInternal(string code)
    Parameters
    Type Name Description
    String code
    Returns
    Type Description
    Locale

    GetLocales()

    Returns all locales that are part of the Addressables system.

    Declaration
    public static ReadOnlyCollection<Locale> GetLocales()
    Returns
    Type Description
    ReadOnlyCollection<Locale>

    GetLocalesInternal()

    Declaration
    protected virtual ReadOnlyCollection<Locale> GetLocalesInternal()
    Returns
    Type Description
    ReadOnlyCollection<Locale>

    GetPreloadTableFlag(LocalizedTable)

    Returns true if the table is marked for preloading.

    Declaration
    public static bool GetPreloadTableFlag(LocalizedTable table)
    Parameters
    Type Name Description
    LocalizedTable table
    Returns
    Type Description
    Boolean

    GetPreloadTableFlagInternal(LocalizedTable)

    Declaration
    protected virtual bool GetPreloadTableFlagInternal(LocalizedTable table)
    Parameters
    Type Name Description
    LocalizedTable table
    Returns
    Type Description
    Boolean
    Exceptions
    Type Condition
    ArgumentNullException
    AddressableEntryNotFoundException

    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
    Type Description
    String

    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
    Type Name Description
    AssetTable table
    UInt32 keyId
    UnityEngine.Object asset
    Boolean createUndo

    RemoveAssetFromTableInternal(AssetTable, UInt32, String, Boolean)

    Declaration
    protected virtual void RemoveAssetFromTableInternal(AssetTable table, uint keyId, string assetGuid, bool createUndo)
    Parameters
    Type Name Description
    AssetTable table
    UInt32 keyId
    String assetGuid
    Boolean createUndo

    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 Name Description
    AssetTable table
    UInt32 keyId
    TObject asset
    Boolean createUndo
    Type Parameters
    Name Description
    TObject

    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
    Type Name Description
    Locale locale
    Boolean createUndo

    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
    Type Name Description
    LocalizedTable table
    Boolean createUndo

    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
    Type Name Description
    LocalizedTable table
    Boolean preload
    Boolean createUndo

    SetPreloadTableInternal(LocalizedTable, Boolean, Boolean)

    Declaration
    protected virtual void SetPreloadTableInternal(LocalizedTable table, bool preload, bool createUndo = false)
    Parameters
    Type Name Description
    LocalizedTable table
    Boolean preload
    Boolean createUndo
    Exceptions
    Type Condition
    ArgumentNullException
    AddressableEntryNotFoundException

    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.

    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023