Communitygithub.com

unity-technologies/generate-editor-search-query

根据自然语言描述生成 Unity Search / Quick Search 查询语句,并打开 Unity Search 窗口,用于只读地查找编辑器中的资源或场景对象。

generate-editor-search-query 是什么?

该技能可将开发者用自然语言提出的 Unity 编辑器搜索请求(如“查找”“搜索”“定位”“过滤”“引用”等)转换为精确的 Unity Search 查询语句,并自动打开 Unity Search 窗口,帮助开发者快速定位资源(材质、纹理、预制体、场景、脚本、着色器等)和场景对象(相机、灯光、刚体、碰撞体、UI 组件等)。它支持多种筛选器,如类型筛选 (`t:`)、路径筛选 (`dir:`)、标签筛选 (`l:`) 和引用筛选 (`ref=`),并会优先使用最简查询。该技能适用于 Cursor、Codex 等 AI 编码工具,通过执行编辑器 C# 代码段来打开 Search 窗口,并在失败时回退为仅显示查询文本。它明确限制为只读操作,不会修改任何资源、场景或项目设置,确保安全。

兼容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/unity-technologies/skills/tree/main/skills/generate-editor-search-query

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

将自然语言的 Unity 编辑器搜索请求转化为有用的 Unity Search 查询语句,简要解释后,在适当时打开 Unity Search 窗口并执行查询。

默认行为

如果提示中明确提到 Unity Search、Quick Search、Search 窗口、打开 Search,或要求提供 Unity Search 查询,则无论目标属于哪个领域(如光照、UI、物理、音频、动画),都使用此技能处理搜索请求。

对于要求“查找”、“搜索”、“定位”、“列出”、“过滤”、“查询”、“在哪里”、“哪些资源使用了”或“什么引用了”具体 Unity 资源或场景对象的请求:

  1. 判断请求主要涉及项目资源、场景对象,还是两者皆有。
  2. 构建一条简洁的 Unity Search 查询语句。
  3. 在响应中显示该查询(在打开 Search 之前或同时)。
  4. 执行编辑器端的代码片段来打开 Unity Search,除非用户明确要求只提供查询文本。
  5. 如果打开 Search 失败,则返回查询语句,并告知用户将其手动粘贴到 Unity Search 中。

当用户明确表示“不要打开 Search”、“仅需查询”、“我该用什么查询”、“只需给我查询”或类似表述时,不要打开 Search。

如果用户要求进行一般性解释、项目概览、文件夹结构总结、架构介绍、游戏玩法系统总结或“如何做”的编程解答,除非提示中明确要求 Unity Search、Search 查询或打开 Search 窗口,否则不要使用此技能。

如果用户提到“这个”、“选中的”或“当前的”,但没有附带具体的资源、场景对象、可见名称或路径,应询问名称/路径,而不是自行编造。

范围

将只读的 Unity Search / Quick Search 查询范围限定为:

  • 项目资源,如材质、纹理、预制体、场景、脚本、着色器、音频剪辑、精灵、网格、模型、动画、字体、渲染纹理和 ScriptableObject 资源
  • 场景对象及其组件,如相机、灯光、刚体、碰撞体、渲染器、Canvas 对象、UI 组件、粒子系统、音源、动画器、地形对象和已命名的 GameObject
  • 基于路径、标签、类型、文件名、关键字和引用的资源搜索
  • 当名称/路径可以从对话或附件中获取时,搜索选中的或已命名的资源

不要安装包、运行菜单命令、编辑资源、修改场景、搜索外部文档、搜索仓库文本、检查构建日志、删除结果、修复搜索结果,或执行依赖关系图分析。如果用户要求对结果执行操作,请先打开 Search 或提供查询,然后在执行任何其他独立的修改技能或工作流之前请求确认。

参考

在生成非平凡查询之前,请阅读 references/query-patterns.md。

在打开 Search 窗口之前,请阅读 references/open-search-window.md。

官方英文参考:

对 eval 传递 C# 代码

eval 编译的是语句块,而非文件。这会导致两个编译错误:

  • 无 using 指令。 编译器会将 using UnityEditor; 解读为资源释放语句并拒绝它(CS0210)。
  • 类型必须完全限定。 单独的 SearchService 无法解析(CS0246),单独的 Object 会与 object 产生歧义(CS0104)。

unity-cli 技能负责必要的先决条件——安装 CLI、确认已连接的编辑器、添加项目的 com.unity.pipeline 包以及发现命令目录。你特别需要 eval;如果它缺失,则生成查询文本并说明无法打开窗口。

查询生成规则

使用最可能产生请求结果的简单查询。

  • 对资源和组件请求,优先使用类型筛选器,如 t:material、t:texture、t:prefab、t:scene、t:script、t:shader、t:Light 或 t:Rigidbody。
  • 保留用户提供的名称和关键字作为纯查询词,除非需要加引号。
  • 当用户指定文件夹或说“在 Assets/... 中”或“在 ... 下”时,使用 dir:。
  • 当用户要求使用 Unity 资源标签时,使用 l:。
  • 当用户询问什么引用了、使用了、依赖于、包含或连接到某个资源时,使用 ref=。
  • 仅当 Search 表达式能明显改善查询时才使用,例如 t:prefab ref={t:texture} 或 t:scene ref={t:prefab}。
  • 对于“选中的/当前的”这种措辞,仅在聊天上下文中存在已知的选中资源名称或路径时才使用;否则询问。
  • 对于宽泛的关系请求,如“Rigidbody 在哪里被使用”,首先使用简单的关键字或组件查询,然后说明如果用户需要彻底的代码/属性分析,则单独的脚本化审核是另外一回事。
  • 对于混合了 Search 和修复工作的请求,首先生成并打开查询;除非用户明确确认后续操作,否则不要修改结果。
  • 对于不确定的请求,不要编造不存在的筛选器。如果某个请求无法用 Unity Search 语法可靠地表达,则打开最近的安全查询并说明限制。

打开 Unity Search

仅在编辑器中运行 C# 代码以打开 Search 窗口。这是一个编辑器 UI 操作,不得更改项目资源或场景内容。

打开 Search 时:

  1. 在生成的 C# 字符串中安全地转义查询。
  2. 对于此 v1 技能,优先使用资源和场景提供程序。
  3. 如果某个提供程序不可用,则回退到活动提供程序。
  4. 记录已打开的查询。
  5. 绝不要声称 Search 已打开(如果命令失败)。

响应格式

保持面向用户的响应简短:

Query: `t:material`
已在 Unity Search 中打开该查询。

如果不打开 Search:

Query: `t:prefab ref={t:texture}`
请将此查询粘贴到 Unity Search 中。

如果请求不明确但仍可搜索,选择最可能的查询并说明假定条件。仅当无法推断搜索目标(例如“找那个东西”且没有提及资源、场景对象、类型、名称或上下文)时才提问。

验证清单

在报告成功之前:

  • 已向用户显示生成的查询
  • 查询目标为资源、场景对象,或两者
  • 仅在用户未选择退出时打开了 Search
  • 已明确说明任何回退或不确定性
  • 未修改任何资源、场景、包、项目设置或搜索结果

Individual skills in this repo

This repo contains 9 individual skills — each has its own dedicated page.

unity-technologies/2d-pixel-perfect

Sets up, diagnoses, and fixes pixel perfect 2D rendering in Unity projects. Use when working on any retro-style or pixel art 2D game.

unity-technologies/audio-setup-mixers

Scans the scene and audio assets to appropriately route Audio Sources into existing Audio Mixer Groups, classifying each source by what it plays. Use when the user asks about cleaning up mixer assignments, routing audio through a mixer, or which group a sound belongs in. Creating mixers and groups, and setting volumes, are not automated — the skill inventories what exists and asks the user to add anything missing.

unity-technologies/build-live-game

Build and operate a live game using Unity Services. Use when the user needs to implement, connect, or debug backend-driven features — battle passes, achievements, player progression, cloud saves, leaderboards, matchmaking, virtual economies, server-authoritative logic, anti-cheat, player accounts and authentication, remote configuration, feature flags, A/B testing, analytics, or cloud resource deployment. Triggers on live-ops, live service, backend, server authority, cloud code, cloud save, remote config, player data, retention, monetization loop, season pass, ranking, multiplayer sessions, lobbies, or any Unity Services integration.

unity-technologies/implement-in-app-purchases

Implement, configure, and debug Unity In-App Purchases (IAP) — store connection, product catalog, consumable/non-consumable/subscription purchases, two-step pending-confirm flow, receipt validation, entitlement checking, restore transactions, Apple extensions (promotional purchases, Ask-to-Buy, code redemption), and Google Play extensions (subscription upgrade/downgrade), D2C Capabilities(direct to customer), 3rd party payment provider (Stripe/Coda) via Unity IAP/Unity Cloud. Use when the user needs to add, modify, debug, or migrate from native Android/iOS billing, 3rd party packages(RevenueCat/Adapty/Essential Kit/Unipay supported) to IAP. Triggers on microtransactions (MTX), monetization, real-money purchases, store purchases, buying items, support D2C, purchase via Stripe/Coda, migrate from native billing(Google's BillingClient or Apple's StoreKit/SKPaymentQueue/SKProduct)/RevenueCat/Adapty/EssentialKit/Unipay.

unity-technologies/initialize-ai-navigation

Sets up and configures the Unity AI Navigation system — NavMesh surfaces, NavMesh agents, obstacles, links, modifiers, areas and costs. Use when creating walkable navigation meshes, adding pathfinding agents, setting up patrol routes, configuring obstacle avoidance and carving, connecting separate NavMeshes with links, coupling navigation with animation, or troubleshooting navigation issues.

unity-technologies/levelplay-unity-integration

Integrates the LevelPlay Mediation SDK via the Ads Mediation UPM package. Use when a developer asks about adding ads to a Unity game, implementing rewarded, interstitial, or banner ads, setting up ad mediation, configuring ad networks, installing or updating the Ads Mediation package, troubleshooting LevelPlay namespace errors, resolving Android gradle or iOS CocoaPods dependency issues for ads, configuring ATT or privacy settings for ad compliance, tracking impression-level revenue (ILRD), initializing the LevelPlay SDK, or setting up ad unit IDs. Also use when a developer wants to monetize their Unity game with ads, asks how to get started with LevelPlay, ads, or mediation, or needs help with any part of the LevelPlay integration workflow including platform-specific setup for iOS or Android. Also use when upgrading the LevelPlay or IronSource SDK version, migrating from deprecated IronSource.Agent APIs, or migrating a game from Unity Ads to LevelPlay.

unity-technologies/localization

Sets up and configures Unity Localization, including locales, String/Asset Tables, CJK font support, and Addressables workflows. Use when the user wants to add languages to a project, translate UI text, support Asian (CJK) languages with TMP fonts, or mentions i18n, l10n, multilingual support, or making a game support multiple languages.

unity-technologies/manage-sprite-atlas

Manage SpriteAtlas using prebuild pipeline with IPreprocessBuildWithReport (DEFAULT approach). Use it to configure master atlases, variant atlases, texture settings, packing settings, and platform-specific configurations. Use when the user asks about creating sprite atlases, optimizing sprites, configuring atlas settings, adding sprites to atlases, creating variant atlases, implementing automated atlas generation, or runtime sprite atlas access. Always use prebuild approach unless user explicitly requests manual authoring.

unity-technologies/migrate-birp-to-urp

Plans, executes, and troubleshoots Unity projects moving from the Built-in Render Pipeline (BiRP/BIRP/Built-in RP) to the Universal Render Pipeline (URP). Use when the user asks to upgrade, convert, switch, or migrate a project, scene, material, or shader to URP/Universal Render Pipeline; fix pink or magenta materials after URP; convert Built-in materials/shaders; move a 2D project to URP 2D; review lighting, quality, post-processing, baked lightmaps, or reflection probes after URP; or diagnose visual problems after a render-pipeline migration.

相关技能