Description
The Get
method in the Editor.MetaData
class is used to retrieve a value associated with a specified key from the metadata. If the key does not exist, it returns a default value provided by the user. This method is generic and can handle any type specified by the user.
Usage
To use the Get
method, you need to provide the key name as a string and a default value of the type you expect to retrieve. The method will return the value associated with the key if it exists; otherwise, it will return the default value.
Example
// Example usage of the Get method
Editor.MetaData metaData = new Editor.MetaData();
// Retrieve an integer value with a default of 10
int intValue = metaData.Get<int>("someIntKey", 10);
// Retrieve a string value with a default of "defaultString"
string stringValue = metaData.Get<string>("someStringKey", "defaultString");
// Retrieve a boolean value with a default of false
bool boolValue = metaData.Get<bool>("someBoolKey", false);