using System.Collections.Generic; using UnityEngine.Advertisements.Utilities; namespace UnityEngine.Advertisements { /// /// A class for sending various metadata to UnityAds. /// public sealed class MetaData { private readonly IDictionary m_MetaData = new Dictionary(); /// /// Metadata category. /// public string category { get; private set; } /// /// Constructs a metadata instance that can be passed to the Advertisement class. /// public MetaData(string category) { this.category = category; } /// /// Sets new metadata fields. /// /// Metadata key. /// Metadata value (must be JSON serializable). public void Set(string key, object value) { m_MetaData[key] = value; } /// /// Returns the stored metadata key. /// public object Get(string key) { return m_MetaData[key]; } /// /// Returns the stored metadata. /// public IDictionary Values() { return m_MetaData; } internal string ToJSON() { return Json.Serialize(m_MetaData); } } }