Communitygithub.com

unity-technologies/generate-editor-search-query

將自然語言中的 Unity Editor 搜尋請求轉換為 Unity Search / Quick Search 查詢,並在適當時開啟 Unity Search 視窗。僅用於唯讀的資產或場景物件查詢。

generate-editor-search-query 是什麼?

此技能專門為 Unity Editor 使用者設計,能將自然語言描述的搜尋請求(如「找到名為 'Player' 的材質」或「列出場景中所有 Light 元件」)翻譯成精確的 Unity Search 查詢語法。使用者只需提出需求,技能就會自動建構最簡潔的查詢字串(例如 `t:material Player` 或 `t:Light`),並在回應中顯示該查詢。如果使用者未明確要求僅輸出查詢文字,技能還會透過 `eval` 執行 C# 指令碼在 Unity Editor 中開啟 Search 視窗,讓您立即看到結果。 此技能的適用範圍嚴格限定於唯讀操作:查詢專案中的資產(如材質、紋理、預製件、場景、腳本、著色器)以及場景中的物件與元件(如攝影機、光源、剛體、粒子系統)。它不執行任何修改、安裝、刪除或依賴關係分析,也無法處理程式設計問題、網路搜尋或檔案系統操作。若使用者要求執行後續修改動作,技能會先提供查詢或開啟視窗,然後請使用者確認後再交由其他適當技能處理。支援的平台包括所有使用 Unity Editor 並安裝 `com.unity.pipeline` 套件的專案。 工作流程如下:首先判斷請求是針對專案資產、場景物件或兩者;接著根據 [references/query-patterns.md](references/query-patterns.md) 中的規則生成查詢;然後將查詢顯示給使用者;最後在條件允許時執行 Editor 端的 `SearchService.ShowWindow` 來開啟 Search 視窗,並記錄操作結果。如果無法開啟視窗(例如 `eval` 不可用),則回退為僅提供查詢文字,並建議使用者手動貼入 Unity 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 Editor 搜尋請求轉換為有用的 Unity Search 查詢,簡短說明查詢內容,並在適當時開啟 Unity Search 視窗。

預設行為

如果提示中明確提到 Unity Search、Quick Search、Search 視窗、開啟 Search,或要求提供 Unity Search 查詢,則即使目標屬於其他領域(如照明、UI、物理、音訊或動畫),也應使用此技能處理搜尋請求。

對於「找到」、「搜尋」、「定位」、「列出」、「篩選」、「查詢」、「在哪裡」、「哪些資產使用」或「什麼參考了」具體 Unity 資產或場景物件的請求:

  1. 判斷請求主要是關於專案資產、場景物件,還是兩者兼具。
  2. 建立一個簡潔的 Unity Search 查詢。
  3. 在回應中顯示該查詢(無論是否準備開啟 Search)。
  4. 執行 Editor 端的程式碼片段以開啟 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。

官方英文參考資料:

傳遞 C# 給 eval

eval 編譯的是一個語句區塊,而非一個檔案。這會導致兩個後果,且皆為編譯錯誤:

  • 不能使用 using 指示詞。編譯器會將 using UnityEditor; 解讀為資源釋放語句並拒絕編譯(CS0210)。
  • 類型必須使用完整名稱。裸寫的 SearchService 無法解析(CS0246),而裸寫的 Object 會與 object 產生歧義(CS0104)。

unity-cli 技能負責處理必要條件——安裝 CLI、確認已連接 Editor、新增專案的 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 被用在哪裡」,先使用簡單的關鍵字或元件查詢,然後在使用者需要詳盡的程式碼/屬性分析時,說明這需要分開的腳本審計。
  • 對於混合了搜尋與修復工作的請求,先生成並開啟查詢;除非使用者明確確認後續的獨立動作,否則不要修改結果。
  • 對於不確定的請求,不要虛構不支援的篩選器。如果無法用 Unity Search 語法可靠地表達請求,請開啟最接近的安全查詢並說明限制。

開啟 Unity Search

僅為了開啟 Search 視窗而在 Editor 中執行 C#。這屬於 Editor UI 動作,不得變更專案資產或場景內容。

開啟 Search 時:

  1. 在生成的 C# 字串中安全地跳脫查詢。
  2. 對於此 v1 技能,優先使用資產和場景提供者。
  3. 如果某個提供者不可用,則回退到作用中的提供者。
  4. 記錄已開啟的查詢。
  5. 如果命令失敗,絕不聲稱已開啟 Search。

回應格式

保持對使用者顯示的回應簡短:

查詢:`t:material`
已使用此查詢開啟 Unity Search。

如果不開啟 Search:

查詢:`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.

相關技能