docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Method GetStringTableCollection

    GetStringTableCollection(TableReference)

    Returns a StringTableCollection with the matching TableReference.

    Declaration
    public static StringTableCollection GetStringTableCollection(TableReference tableNameOrGuid)
    Parameters
    Type Name Description
    TableReference tableNameOrGuid
    Returns
    Type Description
    StringTableCollection

    Found collection or null if one could not be found.

    Examples

    This example shows how to update a collection by adding support for a new Locale.

    // Create the new Locale
    var locale = Locale.CreateLocale(SystemLanguage.Spanish);
    AssetDatabase.CreateAsset(locale, "Assets/Spanish.asset");
    LocalizationEditorSettings.AddLocale(locale);
    
    // Get the collection
    var collection = LocalizationEditorSettings.GetStringTableCollection("My String Table");
    
    // Add a new table
    var newTable = collection.AddNewTable(locale.Identifier) as StringTable;
    
    // Add a new entry to the table
    var entry = newTable.AddEntry("Hello", "Hola");
    
    // Add some metadata
    entry.AddMetadata(new Comment { CommentText = "This is a comment"});
    
    // We need to mark the table and shared table data entry as we have made changes
    EditorUtility.SetDirty(newTable);
    EditorUtility.SetDirty(newTable.SharedData);
    In This Article
    Back to top
    Copyright © 2024 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)