API reference

WitValue Class

Extends ScriptableObject
Base class for ScriptableObject assets that extract and compare typed values from Wit.ai JSON response data. Supports creating reusable value extractors that can be configured in the Unity Inspector with JSON paths.
Create a custom value extractor asset:
// Create a float value extractor in the Unity Editor
var confidenceValue = ScriptableObject.CreateInstance<WitFloatValue>();
confidenceValue.path = "intents[0].confidence";

// Use it to extract values from responses
var response = WitResponseNode.Parse("{\"intents\":[{\"confidence\":0.95}]}");
float confidence = (float)confidenceValue.GetValue(response);
bool isHighConfidence = confidenceValue.Equals(response, 0.9f);

Fields

path : string
JSON path to the value in the Wit.ai response (e.g., "intents[0].name", "entities.location[0].value").
Signature
string Meta.WitAi.Data.WitValue.path

Properties

[Get]
Gets the response reference object used to navigate the JSON path. Lazily initialized on first access and cached for subsequent calls.
Signature
WitResponseReference Meta.WitAi.Data.WitValue.Reference

Methods

Equals ( response , value )
Compares the value at the configured path in the response with a target value.
Signature
abstract bool Meta.WitAi.Data.WitValue.Equals(WitResponseNode response, object value)
Parameters
response: WitResponseNode  The Wit.ai JSON response node to extract from
value: object  The value to compare against
Returns
abstract bool  True if the values match according to the subclass's equality logic
GetValue ( response )
Extracts the typed value from the Wit.ai response at the configured path.
Signature
abstract object Meta.WitAi.Data.WitValue.GetValue(WitResponseNode response)
Parameters
response: WitResponseNode  The Wit.ai JSON response node to extract from
Returns
abstract object  The extracted value as an object (actual type depends on subclass)
ToString ( response )
Gets the string representation of the value at the configured path.
Signature
string Meta.WitAi.Data.WitValue.ToString(WitResponseNode response)
Parameters
response: WitResponseNode  The Wit.ai JSON response node to extract from
Returns
string  String representation of the value