Avoid common Unity mistakes — lifecycle ordering, GetComponent caching, physics timing, and Unity's fake null.
数据来源:ClawHub。 在 ClawSkills 查看
选择你使用的 Agent
方法一:命令行安装(推荐)
推荐(无需提前安装 clawhub)
npx clawhub@latest --dir ~/.claude/skills install unity或使用 clawhub CLI(需提前安装)
clawhub --dir ~/.claude/skills install unity⚠️ 需要 Node.js 18+,没有 Node?请使用下方方法二直接下载 ZIP。 安装 Node.js →
方法二:手动下载安装(无需 Node)
下载 ZIP,解压后将文件夹放到以下路径,重启 Agent 即可:
安装路径
~/.claude/skills/unity/💡解压后将文件夹放到上方路径,重启 Agent 即可生效
--- name: Unity description: Avoid common Unity mistakes — lifecycle ordering, GetComponent caching, physics timing, and Unity's fake null. metadata: {"clawdbot":{"emoji":"🎮","os":["linux","darwin","win32"]}} ---
Awake before Start — use Awake for self-init, Start for cross-referencesOnEnable called before Start — but after AwakeAwake called even if disabled — Start only when enabledGetComponent every frame is slow — cache in Awake or StartGetComponentInChildren searches recursively — expensive on deep hierarchiesTryGetComponent returns bool — avoids null check, slightly fasterRequireComponent attribute — ensures dependency, documents requirementFixedUpdate, not Update — consistent regardless of framerateFixedUpdate can run 0 or multiple times per frame — don't assume 1:1Rigidbody.MovePosition in FixedUpdate — transform.position bypasses physicsTime.deltaTime in Update, Time.fixedDeltaTime in FixedUpdate — or just use deltaTime== null returns true, but object exists?. doesn't work properly — use == null or bool conversionDestroy doesn't happen immediately — object gone next frameDestroyImmediate only in editor — causes issues in buildsStartCoroutine needs MonoBehaviour active — disabled/destroyed stops coroutinesyield return null waits one frame — yield return new WaitForSeconds(1) for timeStopCoroutine needs same method or Coroutine reference — string overload unreliableInstantiate is expensive — pool frequently created/destroyed objectsInstantiate(prefab, parent) sets parent — avoids extra SetParent callSetActive(false) before returning to pool — not Destroy[SerializeField] for private fields in inspector — prefer over publicpublic fields auto-serialize — but exposes API you may not want[HideInInspector] hides but still serializes — [NonSerialized] to skip entirelyCreateAssetMenu attribute for easy creation — right-click → CreateFind methods every frame — cache referencesCompareTag("Enemy"), not tag == "Enemy"NonAlloc variants: RaycastNonAllocasync/await without context — use UniTask or careful error handling安装 Unity 后,可以对 AI 说这些话来触发它
Help me get started with Unity
Explains what Unity does, walks through the setup, and runs a quick demo based on your current project
Use Unity to avoid common Unity mistakes — lifecycle ordering, GetComponent cach...
Invokes Unity with the right parameters and returns the result directly in the conversation
What can I do with Unity in my general tools workflow?
Lists the top use cases for Unity, with example commands for each scenario
将技能文件夹放到 ~/.claude/skills/unity/ 目录(个人级,所有项目可用),或 .claude/skills/unity/(项目级)。重启 AI 客户端后,用 /unity 主动调用,或让 AI 根据上下文自动发现并使用。
Unity 支持 Claude、Cursor、OpenClaw,可与这些 AI 平台无缝集成,扩展其能力。
Unity 可免费安装使用。请查阅仓库了解许可证信息。
Avoid common Unity mistakes — lifecycle ordering, GetComponent caching, physics timing, and Unity's fake null.
Unity 属于「General Tools」分类,该分类的技能帮助 AI 智能体在此领域执行专业任务。
Automate my general tools tasks using Unity
Identifies repetitive steps in your workflow and sets up Unity to handle them automatically