MetadataAttribute
Declares where a metadata kind may be attached and how it appears in the editor's "Add Metadata" menu.
Read time 4 minutesLast updated 6 days ago
Definition
- Type: Class
- Namespace: Unity.Localization
- Assembly: UnityEngine.LocalizationRuntimeModule
- Inherits from: Attribute
[AttributeUsage(AttributeTargets.Class)]public class MetadataAttribute : Attribute
Remarks
Apply this attribute to an IMetadata implementation. MetadataAttribute.AllowedTypes limits the targets the editor offers the metadata on, MetadataAttribute.MenuItem sets the menu label, and MetadataAttribute.AllowMultiple controls whether more than one item of the kind can be added to the same target.
Restrict a custom metadata kind to shared table entries and give it a menu label.
Examples
using System;using Unity.Localization;namespace Unity.Localization.Samples{ [Metadata(AllowedTypes = MetadataType.SharedTableEntry, MenuItem = "Translator Note", AllowMultiple = false)] [Serializable] public class MetadataAttributeExample : IMetadata { public string note; }}
Properties
Property | Description |
|---|---|
| AllowedTypes | Where this metadata may be attached. |
| AllowMultiple | Whether more than one of this metadata kind may be added to the same target. |
| MenuItem | The menu path shown in the "Add Metadata" menu. |