Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


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

[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.
Additional Resources: MetadataType, IMetadata, Comment
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

AllowedTypesWhere this metadata may be attached.
AllowMultipleWhether more than one of this metadata kind may be added to the same target.
MenuItemThe menu path shown in the "Add Metadata" menu.

Inheritance

Inherited Members