docs.unity3d.com
    Show / Hide Table of Contents

    Platform Overrides

    To change where a Localized value for an entry in a String Table Collection or Asset Table Collection should be taken from, use a Platform Override.

    You can add Platform Overrides Metadata to an Entry’s Locale specific or Shared Metadata. If a Platform Override exists for the platform that the application is running on, the Override value will be used instead of the default entry value. The Locale override will first be evaluated. If no override is found for the Locale, the Shared Override will be evaluated instead.

    Create a new Platform Override by clicking the Add (+) button. This shows the available platforms that do not currently have an override. To remove a Platform Override, select them and click the Remove (-) button.

    Entry Type Override

    The Platform Override provides 3 ways to override an entry in a Table Collection. You can use different Override Types within the same Entry based on requirements.

    Entry mode

    To extract a localized value from a separate Entry from the same Table, use Entry Mode . This means all Localized values can be stored in the same table.

    An example of a String Table Collection using Entry Platform Overrides. An example of a String Table Collection using Entry Platform Overrides.

    Table mode

    To extract a localized value from a separate table with the same Entry name, use Table mode. This allows you to have multiple Table Collections that use the same Entry Name but have different values for each platform. It is safe for the Entries in different tables to have different Key Id's because only the name is considered when using the platform table.

    Example of a String Table Collection using Table Platform Overrides. Example of a String Table Collection using Table Platform Overrides.

    The PS4 Table. The PS4 Table.

    The Android Table. The Android Table.

    Table And Entry mode

    To extract a localized value from a separate table and entry, use Table and Entry mode.

    Example of a String Table using a different Table and Entry for each platform override. Example of a String Table using a different Table and Entry for each platform override.

    The Platform Override Table. The Platform Override Table.

    Custom Entry Overrides

    It is possible to create custom overrides that can be applied to a table entry or the shared table entry. For example you may want to change a localized value for a particular region or another criteria such as the date. The Entry Override is evaluated during the Get Table Entry phase:

    The Entry Override is evaluated during the Get Table Entry operation.

    To create a custom override implement the IEntryOverride interface. The following example shows how to create an override that will only be applied on a chosen day of the week.

    
    [Serializable]
    [Metadata(AllowedTypes = MetadataType.AllTableEntries | MetadataType.StringTableEntry)]
    public class DayOverride : IEntryOverride
    {
        public LocalizedString myOverride = new LocalizedString();
    
        public DayOfWeek day = DayOfWeek.Friday;
    
        public EntryOverrideType GetOverride(out TableReference tableReference, out TableEntryReference tableEntryReference)
        {
            if (DateTime.Now.DayOfWeek == day)
            {
                tableReference = myOverride.TableReference;
                tableEntryReference = myOverride.TableEntryReference;
                return EntryOverrideType.TableAndEntry;
            }
    
            // Do not override.
            tableReference = default;
            tableEntryReference = default;
            return EntryOverrideType.None;
        }
    }
    
    

    In this example the “Normal Text” entry will be used as the default, when the day is Friday the entry will be overridden and redirected to the Friday Text entry instead. In this example the “Normal Text” entry will be used as the default, when the day is Friday the entry will be overridden and redirected to the Friday Text entry instead.

    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