docs.unity3d.com

Localization 1.5.1

Search Results for

    Show / Hide Table of Contents

    Method PreloadTables

    PreloadTables(TableReference, Locale)

    Preloads the selected table. If the table is an AssetTable its assets will also be loaded. Check IsDone to see if the data is available, if it is false then you can use the Completed event to get a callback when it is finished, yield on the operation or call WaitForCompletion to force the operation to complete.

    Declaration
    public AsyncOperationHandle PreloadTables(TableReference tableReference, Locale locale = null)
    Parameters
    Type Name Description
    TableReference tableReference

    A reference to the table. A table reference can be either the name of the table or the table collection name Guid.

    Locale locale

    The Locale to use instead of the default SelectedLocale

    Returns
    Type Description
    AsyncOperationHandle

    PreloadTables(IList<TableReference>, Locale)

    Preloads the matching tables for the selected Locale. If the tables are AssetTable then their assets will also be loaded. Check IsDone to see if the data is available, if it is false then you can use the Completed event to get a callback when it is finished, yield on the operation or call WaitForCompletion to force the operation to complete.

    Declaration
    public AsyncOperationHandle PreloadTables(IList<TableReference> tableReferences, Locale locale = null)
    Parameters
    Type Name Description
    IList<TableReference> tableReferences

    An IList of tableReferences to check for the string.

    Locale locale

    The Locale to use instead of the default SelectedLocale

    Returns
    Type Description
    AsyncOperationHandle
    Examples

    This shows how to manually preload tables instead of marking them as Preload in the editor.

    public class PreloadingSample : MonoBehaviour
    {
        IEnumerator Start()
        {
            // Tables that are not marked as Preload can be manually preloaded.
            var preloadOperation = LocalizationSettings.StringDatabase.PreloadTables(new TableReference[] { "UI Text", "Game Text" });
            yield return preloadOperation;
    
            // Get some text from the table, this will be immediately available now the table has been preloaded
            var uiText = LocalizationSettings.StringDatabase.GetTableEntryAsync("UI Text", "Start_Game").Result;
            Debug.Log(uiText);
        }
    }
    In This Article
    • PreloadTables(TableReference, Locale)
    • PreloadTables(IList<TableReference>, Locale)
    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)