Neocortex
IntegrationsUnity SDKAPI Reference

Neocortex Event Logger

Reference for the Neocortex Event Logger static class in Unity

Experimental

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

The NeocortexEventLogger is a static class utility that manages a buffer of event logs. These logs are used to provide non-chat world context to your characters.

When things happen in your game world that the NPC should be aware of but weren't part of a direct conversation (e.g., world-altering events, faction changes, or environment updates), you can push them to the logger. These events ensure the NPC maintains a logical, chronological understanding of the world state.

Tip

To ensure your NPC correctly understands the entities mentioned in your logs (like names of people, places, or objects), make sure to define them in the Reference Node of the character in the Neocortex Web Platform.

For example, if you log an event about "President Miller", define "President Miller" in the Reference Node as "The current President of Lab Corp".

Methods

Push

Adds a new event log to the buffer. Note that the event content has a maximum length of 64 characters; logs exceeding this limit will be dropped with a warning.

  • Parameters:
    • priority: The EventPriority (e.g., Low, Medium, High) to determine the importance of the log during selection.
    • content: A string (max 64 chars) describing the world event.
    • date: An optional free-form string to provide chronological context (e.g., "Day 1", "2024-03-06").
Push Example
using Neocortex;
using Neocortex.Data;

// World event with High priority and custom date/time context
NeocortexEventLogger.Push(EventPriority.High, "The President is bitten by a zombie and is infected", "Day 11");

// High priority immediate event without a date
NeocortexEventLogger.Push(EventPriority.High, "The city gates have fallen");

// Medium priority context
NeocortexEventLogger.Push(EventPriority.Medium, "Quest updated: Find the cure", "Day 12");

Clear

Clears all event logs from the static buffer. This is typically called after the logs have been successfully synced with the Neocortex project via the Smart Agent.

Clear Example
NeocortexEventLogger.Clear();

On this page