Neocortex
IntegrationsUnity SDKAPI Reference

Neocortex Session Manager

Reference for the Neocortex Session Manager class in Unity

The NeocortexSessionManager is a static class that provides methods to manage chat session IDs for characters. Session IDs are stored locally using PlayerPrefs, allowing for persistent conversations across game sessions.

Methods

SetSessionID

Sets a session ID for a specific character.

  • Parameters:
    • characterID: The unique identifier for the character.
    • sessionId: The session ID to store.
SetSessionID Example
using Neocortex;

// Store a session ID for a character
NeocortexSessionManager.SetSessionID("char_123", "session_abc");

GetSessionID

Retrieves the stored session ID for a specific character.

  • Parameters:
    • characterID: The unique identifier for the character.
  • Returns: The session ID string, or an empty string if no session ID is found.
GetSessionID Example
using Neocortex;

// Retrieve the session ID for a character
string sessionId = NeocortexSessionManager.GetSessionID("char_123");

if (!string.IsNullOrEmpty(sessionId))
{
    Debug.Log($"Current Session ID: {sessionId}");
}

CleanSessionID

Clears the stored session ID for a specific character, effectively starting a new conversation history for that character.

  • Parameters:
    • characterID: The unique identifier for the character.
CleanSessionID Example
using Neocortex;

// Clear the session ID to start a new chat history
NeocortexSessionManager.CleanSessionID("char_123");

On this page