API reference
API reference
Select your platform
No SDKs available
No versions available

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

JSON path to the value in the Wit.ai response (e.g., "intents[0].name", "entities.location[0].value").

Properties

Gets the response reference object used to navigate the JSON path. Lazily initialized on first access and cached for subsequent calls.

Member Functions

Extracts the typed value from the Wit.ai response at the configured path.
Parameters
response
The Wit.ai JSON response node to extract from
Returns
The extracted value as an object (actual type depends on subclass)
Compares the value at the configured path in the response with a target value.
Parameters
response
The Wit.ai JSON response node to extract from
value
The value to compare against
Returns
True if the values match according to the subclass's equality logic
Gets the string representation of the value at the configured path.
Parameters
response
The Wit.ai JSON response node to extract from
Returns
String representation of the value