Version: Unity 6.7 Alpha (6000.7)
LanguageEnglish
  • C#

MetadataAttribute

class in Unity.Localization

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Description

Declares where a metadata kind may be attached and how it appears in the editor's "Add Metadata" menu.

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

<para>Restrict a custom metadata kind to shared table entries and give it a menu label.</para>

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.