docs.unity3d.com
    Show / Hide Table of Contents

    Interface IMetadata

    Interface to indicate a class can be used as Metadata. Metadata is data that can be used to provide additional information about the item it is attached to. Metadata can be attached to a Locale, a LocalizationTable, a table entry or a SharedTableData.

    Metadata is serialized using the SerializeReference feature, this means that it must be marked as serializable, can be shared across the same asset and does not inherit from UnityEngine.Object. Metadata does not have to include serialized fields, it can also be empty and used to tag fields as having certain attributes. See also MetadataAttribute

    Namespace: UnityEngine.Localization.Metadata
    Syntax
    public interface IMetadata
    Examples

    This example shows how Metadata can be created to attach additional region data to a Locale.

    [Serializable]
    [Metadata(AllowedTypes = MetadataType.StringTableEntry)]
    public class TranslationStatus : IMetadata
    {
    public enum TranslationState
    {
       Initial,
       Translated,
       Reviewed,
       Final,
    }
    
    public TranslationState translationStatus = TranslationState.Initial;
    }

    This example shows how Metadata can be created to attach an icon to a Locale.

    [Metadata(AllowedTypes = MetadataType.Locale)]
    [Serializable]
    public class LocaleIcon : IMetadata
    {
    public Texture icon;
    }
    Back to top
    Terms of use
    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