Custom AI tools are now supported.
You can configure them via the top menu bar → Help → AI.
Currently, several example tools are provided, and you can also extend them in specific ways (see Chapter 4 for details).
You can now customize the system prompt.In the AI panel, click the More (three dots in the top-right corner) button → System Prompt to edit it.The prompt added here will be automatically sent to the AI on every call.You can add restrictions and requirements for the AI here.
In the tool interface, click the More (three dots in the top-right corner) button → Export Audit Log to export the AI's work audit log.You can find it in the save directory.By reading this log, you can learn how the AI tools have been used.
A Tool is a bridge for interaction between the AI and the game world. It is a C# method that can be called by the AI. The AI reads the tool's description and parameters, determines in which scenarios to call it, and continues reasoning based on the returned result.
Player input → AI Agent analyzes intent → Decides to call a Tool → Tool executes specific logic → Returns result to AI → AI generates a reply based on the result or continues calling tools
When the player says "Push that red box into the corner," the AI's workflow is:AI analysis: Need to find the red box first → Call find_object("red box")Result obtained: The box is at (5, 0, 3) → Call move_object("box", target position)After completion: Reply to the player, "I have pushed the red box into the corner for you."
Create a new C# script in the Assets/YourProjectName/Scripts/Tools/ directory, for example SayHelloTool.cs.
csharp
using System.Threading; using System.Threading.Tasks; using Newtonsoft.Json.Linq; using UnAI.Tools; namespace RuntimeEditor.Tools.Examples { public class SayHelloTool : ToolBase { // ========== Basic Metadata ========== public override string Id => "say_hello"; public override string DisplayName => "Say Hello"; public override string Description => "Greets the player and returns a greeting message."; public override ToolCategory Category => ToolCategory.General; public override ToolRiskLevel RiskLevel => ToolRiskLevel.Low; public override bool DefaultEnabled => true; // ========== Parameter Definition ========== public override UnaiToolDefinition Definition => new() { Name = Id, Description = Description, ParametersSchema = JObject.Parse(@"