Class Metadata
When attached to a GameObject (as a Component), the Metadata will store and display all metadata properties.
Those properties can be automatically imported from the Importer (with the correct settings).
Inherited Members
Namespace: UnityEngine.Pixyz.UnitySDK.Components
Assembly: Unity.Pixyz.UnitySDK.Runtime.dll
Syntax
public class Metadata : MonoBehaviour
Examples
Metadata metadata = gameObject.GetComponent<Metadata>()
string partNumber = metadata.getProperty("Part Number");
Methods
addOrSetProperty(string, string, bool)
Adds or set an existing property value. This is case sensitive.
Declaration
public void addOrSetProperty(string propertyName, string propertyValue, bool notify = true)
Parameters
Type | Name | Description |
---|---|---|
string | propertyName | Name of the property to look for |
string | propertyValue | Value of the property to add or set |
bool | notify | Triggers OnPropertyChanged if true |
containsProperty(string)
Returns true if the metadata contains a property with the given name. This is case sensitive.
Declaration
public bool containsProperty(string propertyName)
Parameters
Type | Name | Description |
---|---|---|
string | propertyName | Name of the property to look for |
Returns
Type | Description |
---|---|
bool | True if the property exists |
getProperties()
Returns the properties as a Dictionary.
Declaration
public Dictionary<string, string> getProperties()
Returns
Type | Description |
---|---|
Dictionary<string, string> | A Dictionary with all properties |
getPropertiesNative()
Returns native properties
Declaration
public Metadata.Properties getPropertiesNative()
Returns
Type | Description |
---|---|
Metadata.Properties | Native properties |
getProperty(string)
Returns a property value from its name. This will produce an exception if no property exists with the given name. This is case sensitive.
Declaration
public string getProperty(string propertyName)
Parameters
Type | Name | Description |
---|---|---|
string | propertyName | Name of the property to look for |
Returns
Type | Description |
---|---|
string | The property value (string) |
removeProperty(string)
Removes a property. Returns true if the operation was successful. This is case sensitive.
Declaration
public bool removeProperty(string propertyName)
Parameters
Type | Name | Description |
---|---|---|
string | propertyName | Name of the property to look for |
Returns
Type | Description |
---|---|
bool | True if the property was removed. False if the property doesn't exists. |
setProperties(Properties)
Sets the properties from Native Interface.
Declaration
public void setProperties(Metadata.Properties properties)
Parameters
Type | Name | Description |
---|---|---|
Metadata.Properties | properties | Native properties |
Events
OnPropertyChanged
Event triggered when a metadata is added/removed or modified.
Declaration
public event Metadata.PropertyChangedHandler OnPropertyChanged
Event Type
Type | Description |
---|---|
Metadata.PropertyChangedHandler |