Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


GetMetadata<T>()

Returns the first metadata item of the given type.
Read time 1 minuteLast updated 10 days ago

Definition

  • Type: Method
  • Namespace: Unity.Localization
  • Assembly: UnityEngine.LocalizationRuntimeModule
public T GetMetadata<T>() where T : class, IMetadata

Returns

Type

Description

TThe first item assignable to
T
, or null when none is present.

Remarks

Use MetadataCollection.GetMetadatas when a target can hold more than one item of the same type.
Read the first comment attached to a collection.

Examples

using Unity.Localization;namespace Unity.Localization.Samples{ public class MetadataCollectionGetMetadataExample { public string Run(MetadataCollection metadata) { var comment = metadata.GetMetadata<Comment>(); return comment?.CommentText; } }}