Logo Unity Behavior

Unity Behavior

Cộng đồngPhổ biến
Besty0728
unity-behavior

Drive Unity Behavior behavior graphs and blackboard variables

Add to TypingMind

Tổng quan

Nhà phát hànhBesty0728
Kho mãUnity-Skills
Tên kỹ năngunity-behavior
Sao
1.8K
Bản fork
164
Tệp đi kèm
Chỉ có hướng dẫn
Giấy phépMIT
Liên kết
  • Hướng dẫn bằng Markdown

    Tệp SKILL.md được mô hình tải khi cần, nên chỉ tốn token khi có yêu cầu thực sự phù hợp.

  • Dùng được với mọi LLM

    Kỹ năng AI dùng hướng dẫn viết bằng Markdown thay vì mã dành riêng cho một nhà cung cấp, nên dùng được với GPT, Claude, Gemini, Grok hoặc mô hình cục bộ.

  • Hướng dẫn có đủ mọi thứ cần thiết

    Mọi thứ mô hình cần đều nằm trong hướng dẫn — không có tệp bổ sung cần đồng bộ.

  • Mã nguồn mở

    Được Besty0728 công bố trên GitHub. Hãy đọc các tệp nguồn trước khi cài đặt.

Cài đặt

Cài đặt kỹ năng AI Unity Behavior trong TypingMind để dùng với bất kỳ LLM nào, hoặc thêm vào một tác nhân AI khác có thể đọc SKILL.md.

1

Cài đặt trong TypingMind

TypingMind cài đặt kỹ năng trực tiếp từ thư mục GitHub — đọc SKILL.md, đóng gói các tệp tài nguyên và lưu kết quả trên máy.

  1. Mở ứng dụng và vào Plugin → Kỹ năng.
  2. Chọn "Cài đặt từ GitHub".
  3. Dán URL của thư mục kỹ năng được hiển thị bên dưới rồi xác nhận.
    https://github.com/Besty0728/Unity-Skills/tree/main/SkillsForUnity/unity-skills~/skills/behavior
  4. Bật kỹ năng trong từng cuộc trò chuyện mà bạn muốn sử dụng kỹ năng đó.
Plugin → Kỹ năng → Thêm kỹ năng → Từ URL GitHub, sau đó dán URL thư mục và nhấn Tiếp tục.

Sử dụng trong TypingMind

Bật Unity Behavior trong bất kỳ cuộc trò chuyện nào trên TypingMind, mô hình sẽ tự xử lý phần còn lại. Tên và mô tả của kỹ năng nằm trong prompt hệ thống. Ngay khi có yêu cầu phù hợp, mô hình tự tải toàn bộ hướng dẫn — bạn không cần gọi thủ công và kỹ năng không tốn token cho đến khi thực sự được dùng.

Mô hình tự nạp Unity Behavior ngay khi có yêu cầu phù hợp.

Dùng được với mọi mô hình AI

Kỹ năng AI là các hướng dẫn Markdown thuần túy, không phải mã dành riêng cho một nhà cung cấp, nên bạn có thể dùng Unity Behavior với cả những mô hình khác ngoài mô hình ban đầu. Chỉ cần cài đặt một lần trong TypingMind rồi dùng với GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama hoặc mô hình cục bộ do bạn tự chạy — tất cả đều dùng khóa API của riêng bạn.

  • Chỉ tải khi cần

    Prompt hệ thống chỉ chứa tên và mô tả. Hướng dẫn được tải khi có yêu cầu phù hợp đầu tiên, nên khi kỹ năng chưa được dùng, bạn không tốn token cho phần hướng dẫn.

  • Đổi mô hình ngay trong cuộc trò chuyện

    Vì kỹ năng là hướng dẫn chứ không phải mã, việc đổi mô hình không làm kỹ năng ngừng hoạt động — mô hình tiếp theo vẫn đọc cùng tệp SKILL.md.

Hướng dẫn của kỹ năng

Đây là nội dung SKILL.md mà mô hình tải. Hãy đọc trước khi cài đặt — kỹ năng là những hướng dẫn mà mô hình của bạn sẽ làm theo.

Before calling any skill in this module: if you are about to call a skill with parameters guessed from its name or description, STOP — read this file (or fetch its schema via GET /skills/recommend?includeSchema=true) first. If you already have the parameter definitions from recommend/schema, you may proceed straight to dryRun.

Triggers

  • Wiring NPC/AI decision logic
  • Working with behavior trees/graphs
  • Reading/writing blackboard variables
  • 搭建 NPC/AI 决策逻辑、使用行为树/行为图、读写黑板变量

Behavior Skills

Unity Behavior (com.unity.behavior, validated against 1.0.16) graph asset discovery, agent wiring, and blackboard variable access.

The package is optional and is not a declared dependency of UnitySkills. Every skill in this module reaches it through reflection; when it is absent each skill returns the same structured PACKAGE_NOT_INSTALLED response pointing at package_install.

Operating Mode

  • Query skills (behavior_status, behavior_graph_list, behavior_graph_info, behavior_agent_get, behavior_agent_list, behavior_blackboard_list) are SkillMode.SemiAuto — they run in all three modes without a grant.
  • Mutators (behavior_graph_create, behavior_agent_add, behavior_agent_set_graph, behavior_blackboard_set) are SkillMode.FullAuto — under Approval they need a user grant; under Auto / Bypass they execute directly.
  • No skill in this module carries SkillOperation.Delete, so none is auto-forbidden in Approval / Auto mode.

Prerequisites

Install the package first if behavior_status reports installed: false:

package_install  packageName="com.unity.behavior"

Installation triggers a Domain Reload; wait for it to finish, then call behavior_status again before using any other skill in this module.

The two asset types (read this before binding graphs)

A "Behavior Graph" .asset file contains two objects, and mixing them up is the most common failure:

ObjectRoleWhere it lives
BehaviorAuthoringGraphEditing representation — nodes, blackboard, story. Main asset.The .asset file itself
BehaviorGraphBaked runtime graph. What BehaviorGraphAgent.Graph actually requires.Sub-asset nested inside the same file

Skills in this module always take the file path (graphAssetPath / assetPath) and resolve the correct object internally — you never address the sub-asset directly. behavior_agent_set_graph finds the nested BehaviorGraph for you and refuses the bind with RUNTIME_GRAPH_MISSING when the graph has never been compiled.

Guardrails

Routing:

  • Behavior graphs / blackboards / BehaviorGraphAgent: this module
  • Animator state machines: use animator_*
  • Generic component attach on a GameObject: component_add works, but behavior_agent_add additionally binds the graph and validates it

Runtime-first rules:

  • Always call behavior_blackboard_list before behavior_blackboard_set — the variable name is case-sensitive and the declared CLR type decides which value shapes are accepted.
  • Never invent a graphAssetPath from memory; get it from behavior_graph_list.
  • If a skill returns errorCode: "API_MISMATCH", the installed package version has a different member layout than this integration expects. Do not retry with different arguments — report the version mismatch and fall back to the Behavior editor window or direct .asset text editing.
  • A graph created by behavior_graph_create is empty apart from the auto-inserted Start root. Adding actual behavior nodes requires the Behavior editor window (see Limitations).

Skills

behavior_status

Report package availability: installed, version, which core types resolved, project graph asset count, and scene agent count. Safe to call when the package is missing — this is the one skill that answers instead of erroring.

behavior_graph_list

List behavior graph assets with path, guid, nodeCount, variableCount, and hasRuntimeGraph. Optional filter (substring on path), folder, limit.

behavior_graph_info

Structure summary for one graph asset: node count with a per-type breakdown, individual nodes (id / type / position, capped by maxNodes), root count, the full blackboard variable list with types and default values, subgraph dependencies, and runtime graph state.

behavior_graph_create

Create an empty BehaviorAuthoringGraph at savePath and force a reimport so Unity bakes the blackboard, the runtime BehaviorGraph sub-asset, the debug info sub-asset, and the mandatory Start root. Returns hasRuntimeGraph; a warning is returned when baking did not happen and the graph must be opened once in the editor window.

behavior_agent_add

Add a BehaviorGraphAgent to a GameObject (name / instanceId / path), optionally binding graphAssetPath in the same call. The graph is resolved and validated before the component is added, so a bad path never leaves a half-configured agent. Idempotent — an existing agent is reused and reported via componentAdded: false.

behavior_agent_get

Read one agent: bound graph name and asset path, isInitialised / isStarted / isRunning, the graph's blackboard variables, and the agent-level overrides.

behavior_agent_set_graph

Bind graphAssetPath to an existing agent. Resolves the nested runtime graph and rejects uncompiled graphs.

behavior_agent_list

Every BehaviorGraphAgent in the loaded scenes with hierarchy path, bound graph, active/enabled flags, and run state. Optional graphFilter, includeInactive, limit.

behavior_blackboard_list

List blackboard variables. Pass graphAssetPath to read the asset's authoring defaults (source: "asset"), or a GameObject locator to read an agent's graph variables plus its overrides (source: "agent"). One of the two is required.

behavior_blackboard_set

Set one variable value.

ParameterMeaning
variableVariable name, case-sensitive. Required.
valueNew value. Accepted shapes depend on the declared type (see below).
name / instanceId / pathGameObject locator — writes the agent-level override.
graphAssetPathWrites the graph asset default and rebakes the runtime blackboard.

Provide either the GameObject locator or graphAssetPath; the GameObject wins if both are given.

Returns: target ("agent" or "asset"), variable, type, the normalized value, and a note explaining where the write landed.

Supported value types and accepted input shapes:

Declared typeAccepted value
int / float / double / bool / stringJSON scalar, or a parseable string
enumMember name (case-insensitive)
Vector2 / Vector3 / Vector4 / Quaternion[1,2,3], {"x":1,"y":2,"z":3}, or "1,2,3"
Color{"r":1,"g":0,"b":0,"a":1}, [1,0,0,1], or "#FF0000"
Vector2Int / Vector3IntSame as the float vectors, truncated
GameObject / ComponentAssets/... prefab path, scene hierarchy path, or scene object name
Other UnityEngine.ObjectAssets/... or Packages/... asset path

Setting an unknown variable returns the available names in availableVariables.

Edit mode vs Play mode

BehaviorGraphAgent instantiates a private copy of its graph on Init(), which only happens in Play mode. This changes what reads and writes mean:

  • Edit mode — behavior_blackboard_set with a GameObject writes an agent-level override (exactly what the Inspector shows). Reads of the graph variables return the shared asset defaults, not per-agent values; the per-agent values are in the overrides array.
  • Play mode — writes go to the running graph instance, so they take effect immediately on that agent only.

This is why behavior_blackboard_list reports both variables and overrides for an agent.

Workflow

  1. behavior_status — confirm the package is installed.
  2. behavior_graph_list — locate the graph, or behavior_graph_create to make a new one.
  3. Author the node graph in the Behavior editor window (node editing is not scriptable — see Limitations).
  4. behavior_graph_info — confirm the node topology and read the blackboard contract.
  5. behavior_agent_add with graphAssetPath — attach and bind in one call.
  6. behavior_blackboard_list — read the exact variable names and declared types.
  7. behavior_blackboard_set — per-agent overrides, or graph-wide defaults via graphAssetPath.
  8. behavior_agent_list — verify the whole scene's agent wiring.

Limitations

Node-level graph editing is not supported. There is no skill to add, remove, connect, or reconfigure nodes inside a behavior graph. This is a deliberate exclusion, not an oversight:

  • The authoring node graph is stored as a [SerializeReference] polymorphic List<NodeModel> with PortModel cross-references, an embedded SerializableCommandBuffer, and a version-stamped NodeModelInfo cache. Writing it correctly means reproducing the package's command/dispatcher pipeline, not just setting fields.
  • Every edit must be followed by a consistent rebake of three sub-assets (runtime graph, runtime blackboard, debug info) plus VersionTimestamp synchronization, or the asset silently desyncs from its baked runtime graph.
  • The serialization schema is explicitly versioned (kLatestSerializationVersion, currently 3) and has changed within the 1.0.x line. Reflection-driven topology writes would break on a patch release.

Alternatives when you need node-level changes:

  1. Preferred — author the graph in the Behavior editor window (Window > AI > Behavior, or double-click the asset), then use this module to inspect and wire it up.
  2. Duplicate a known-good graph with asset_duplicate and rebind it, instead of building topology from nothing.
  3. For mechanical, repetitive edits to an existing graph, edit the .asset YAML directly — load the yaml-editing advisory first for the managed-reference and fileID rules, and re-verify with behavior_graph_info afterwards.

Other limitations:

  • behavior_graph_create produces an empty graph. Node authoring still requires the editor window.
  • Blackboard variables cannot be created, renamed, retyped, or deleted — only existing variables can be assigned. Add variables in the Behavior editor's Blackboard panel.
  • Event channels, subgraph dynamic linking, and runtime serialization (Serialize / Deserialize) are not exposed.
  • behavior_blackboard_set against graphAssetPath changes the shared default for every agent that has no override for that variable.
  • Agent lifecycle control (Init / Start / End / Restart) is not exposed; those are Play-mode runtime concerns better handled from game code.

Version Sensitivity

Type and member names were taken from com.unity.behavior 1.0.16 sources and cross-checked against the published Scripting API. Public surface (BehaviorGraphAgent, BehaviorGraph, BlackboardReference, Blackboard, BlackboardVariable, VariableModel) is documented and stable. Authoring surface (BehaviorAuthoringGraph, GraphAsset, BlackboardAsset, BehaviorBlackboardAuthoringAsset) is internal to the package and reached by name — a package upgrade can move it. Every such lookup is null-checked and reports API_MISMATCH rather than throwing; behavior_status shows exactly which types resolved.


Exact Signatures

Exact names, parameters, defaults, and returns are defined by GET /skills/schema or unity_skills.get_skill_schema(), not by this file.

Câu hỏi thường gặp

Kỹ năng AI Unity Behavior làm được gì?

Drive Unity Behavior behavior graphs and blackboard variables

Vì sao nên dùng Unity Behavior trên TypingMind?

Vì bạn chỉ cần cài một lần rồi dùng với bất kỳ mô hình nào. Unity Behavior là nội dung Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên cùng một kỹ năng có thể chạy trên GPT-5, Claude, Gemini, Grok hoặc mô hình trên thiết bị — và bạn có thể đổi mô hình ngay trong cuộc trò chuyện mà kỹ năng vẫn hoạt động. TypingMind dùng khóa API riêng của bạn, nên bạn thanh toán trực tiếp cho nhà cung cấp thay vì trả phí thuê bao theo suất người dùng, đồng thời kỹ năng và các cuộc trò chuyện vẫn nằm trong bộ lưu trữ của bạn.

Làm thế nào để cài Unity Behavior trong TypingMind?

Mở Plugin → Kỹ năng → Cài đặt từ GitHub trong TypingMind rồi dán https://github.com/Besty0728/Unity-Skills/tree/main/SkillsForUnity/unity-skills~/skills/behavior. TypingMind đọc tệp SKILL.md rồi cài đặt kỹ năng để bạn có thể bật cho từng cuộc trò chuyện.

Những mô hình AI nào có thể dùng Unity Behavior?

Bất kỳ mô hình nào bạn kết nối trong TypingMind. Kỹ năng AI là các hướng dẫn bằng Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên GPT, Claude, Gemini, Grok và các mô hình chạy trên thiết bị đều có thể tải kỹ năng này khi có yêu cầu phù hợp.

Có thể dùng Unity Behavior với bao nhiêu mô hình AI?

Bao nhiêu cũng được. Miễn là mô hình hỗ trợ kỹ năng, bạn có thể dùng Unity Behavior với mô hình đó — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama và nhiều mô hình khác — tất cả đều trên TypingMind với khóa API riêng của bạn.

Kỹ năng AI Unity Behavior có miễn phí không?

Có. Kỹ năng này được Besty0728 phát hành trên GitHub theo giấy phép MIT. Bạn chỉ trả tiền cho nhà cung cấp AI của mình theo số token đã dùng.

Kỹ năng AI là gì?

Kỹ năng AI là một gói hướng dẫn có thể tái sử dụng, chỉ cho mô hình AI cách thực hiện một tác vụ cụ thể. Kỹ năng tuân theo định dạng mở Agent Skills: một tệp SKILL.md chứa tên và mô tả, cùng các tập lệnh, mẫu hoặc tệp tham khảo mà mô hình có thể cần. Mô hình chỉ đọc hướng dẫn khi yêu cầu của bạn phù hợp với kỹ năng, nên kỹ năng đã cài đặt không phát sinh chi phí cho đến khi được sử dụng.

Kỹ năng AI khác gì với plugin hoặc máy chủ MCP?

Plugin hoặc máy chủ MCP cung cấp các công cụ mới mà mô hình có thể gọi. Khi mô hình gọi một công cụ, mã của công cụ đó chạy ở đâu đó và trả về kết quả. Còn kỹ năng AI cung cấp kiến thức và quy trình: cách tiếp cận tác vụ, các bước cần thực hiện và những tiêu chí mà kết quả cần đáp ứng. Kỹ năng chỉ là nội dung Markdown, nên không cần máy chủ, khóa API hay môi trường thực thi và hoạt động với mọi mô hình.

Xem tất cả

Tạo ngay không gian làm việc AI riêng

Đăng ký bản tin của chúng tôi để nhận thông báo về tính năng mới và các đợt tặng quà sắp tới 👇