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 |
|---|---|
| T | The first item assignable to |
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; } }}