Neocortex
IntegrationsUnity SDKAPI Reference

Neocortex Interactable

Reference for the Neocortex Interactable component in Unity

Experimental

The Neocortex Interactable system is currently an experimental feature. Its API and behavior may change in future SDK updates.

The NeocortexInteractable component allows NPCs to become aware of objects within the game world. By attaching this component to a GameObject, you can define its type, name, and key-value properties. This enables the Smart Agent to reason about the scene, identify specific objects as subjects of conversation or actions, and understand their spatial locations.

Neocortex Interactable

Component Configuration

  • Type: Choose between Object or Character. To make an NPC aware of its own location and identity within the interactable system, attach this component to the character GameObject and set its type to Character.
  • Name: The identifier for the interactable. This is required when the type is set to Object.
  • Properties: An array of key-value pairs (maximum 5 items) that provide specific context to the Smart Agent (e.g., "State": "Broken", "Material": "Wooden").

Members

  • isSubject: A boolean that indicates if this specific interactable was the subject of the last agent response.
  • position: The position of the interactable in the world.

Methods

  • ToJSON: Returns a JSON representation of the interactable.

How it Works

When you send a request to the Smart Agent, the system can process the interactables in your scene. If an NPC decides to act upon or reference a specific object, that object will be marked as the Subject in the response metadata.

Example Scenario:

Imagine you have a character with DRIVE_CAR action defined, and three cars in your scene with the following properties:

Object NameKeyValue
Car AColorRed
Car BColorBlue
Car CColorGreen

If the player says,

Enter the car with the color of the sky

the Neocortex Smart Agent will identify that the Blue Car is the intended target. The response metadata will contain the "Blue Car" interactable with isSubject set to true, allowing your code to trigger the DRIVE_CAR action on the correct GameObject.

Usage Example

Finding the Subject

You can iterate through the response metadata to find which interactable was identified as the subject of the NPC's response.

Identifying the Subject

// Inside your OnChatResponseReceived listener
smartAgent.OnChatResponseReceived.AddListener((response) =>
{
    // Find the interactable marked as the subject
    var subjectInteractable = response.metadata.FirstOrDefault(i => i.isSubject);

    if (subjectInteractable != null)
    {
        Debug.Log($"The NPC is interacting with: {subjectInteractable.name}");
        
        if (response.action == "ENTER_CAR")
        {
            // Logic to move NPC to the specific car's position
            MoveNPCToObject(subjectInteractable.position);
        }
    }
});

Tip

The position of the interactable is automatically captured from the GameObject's transform.position when synced with the agent.

On this page