Iván

Unity

开发编程v1.0.0
作者:Iván更新于 2026-05-11unity@clawhub_ivangdavila/unity
代码生成Bug 修复

据 AlphaMoat 统计,截至 2026-09,Unity 累计下载 3,823 次、获 5 个星标,在全部 5,078 个 AI 技能中排名第 2,751 位,在「开发编程」分类(577 个)中排名第 359 位。

累计安装
368
累计下载
3,823
星标
5
全站排名
#2,751
全站前 55% · 「开发编程」前 63%
平台累计安装累计下载星标评论
ClawHub ↗903,0123-
SkillHub ↗3683,8235—

各平台的计数口径不同,统计时间不一致。

这个技能是做什么的

避免常见的Unity错误——生命周期顺序、GetComponent缓存、物理时机及Unity假null问题

月度数据趋势

累计下载3,823
1,5642,7773,9902026-03 · 累计下载 1,7312026-05 · 累计下载 2,2532026-06 · 累计下载 2,4142026-07 · 累计下载 2,7162026-08 · 累计下载 3,0002026-09 · 累计下载 3,82326-0326-09
星标5
3452026-03 · 星标 32026-05 · 星标 32026-06 · 星标 32026-07 · 星标 42026-08 · 星标 42026-09 · 星标 526-0326-09

2026-09 起统计方法调整:同名技能按作者分别统计,并覆盖全部技能。图中虚线为调整前的月份,与之后的数据不直接比较,也不计算跨越调整的增长。

月份累计下载环比星标
2026-093,823—5
2026-083,000+10.5%4
2026-072,716+12.5%4
2026-062,414+7.1%3
2026-052,253—3
2026-031,731—3

SKILL.md 原文

以下是作者发布的原始文件,按纯文本显示,本站未做修改或审核;其中的链接不可点击,命令请核实后再运行。抓取于 2026-10-23。

3.1 KB · ClawHub v1.0.0
---
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"]}}
---

## Lifecycle Order
- `Awake` before `Start` — use Awake for self-init, Start for cross-references
- `OnEnable` called before `Start` — but after `Awake`
- Order between scripts not guaranteed — use Script Execution Order if needed
展开全部(共 61 行)
- `Awake` called even if disabled — `Start` only when enabled

## GetComponent Performance
- `GetComponent` every frame is slow — cache in `Awake` or `Start`
- `GetComponentInChildren` searches recursively — expensive on deep hierarchies
- `TryGetComponent` returns bool — avoids null check, slightly faster
- Use `RequireComponent` attribute — ensures dependency, documents requirement

## Physics Timing
- Physics in `FixedUpdate`, not `Update` — consistent regardless of framerate
- `FixedUpdate` can run 0 or multiple times per frame — don't assume 1:1
- `Rigidbody.MovePosition` in FixedUpdate — `transform.position` bypasses physics
- `Time.deltaTime` in Update, `Time.fixedDeltaTime` in FixedUpdate — or just use deltaTime

## Unity's Fake Null
- Destroyed objects aren't truly null — `== null` returns true, but object exists
- Null-conditional `?.` doesn't work properly — use `== null` or `bool` conversion
- `Destroy` doesn't happen immediately — object gone next frame
- Use `DestroyImmediate` only in editor — causes issues in builds

## Coroutines
- `StartCoroutine` needs MonoBehaviour active — disabled/destroyed stops coroutines
- `yield return null` waits one frame — `yield return new WaitForSeconds(1)` for time
- `StopCoroutine` needs same method or Coroutine reference — string overload unreliable
- Can't return values — use callbacks or set field in coroutine

## Instantiate and Pooling
- `Instantiate` is expensive — pool frequently created/destroyed objects
- `Instantiate(prefab, parent)` sets parent — avoids extra SetParent call
- `SetActive(false)` before returning to pool — not Destroy
- Pool inactive objects under a parent — keeps hierarchy clean

## Serialization
- `[SerializeField]` for private fields in inspector — prefer over public
- `public` fields auto-serialize — but exposes API you may not want
- `[HideInInspector]` hides but still serializes — `[NonSerialized]` to skip entirely
- Serialized fields keep inspector values — code defaults ignored after first serialize

## ScriptableObjects
- Data containers that live as assets — share between scenes/prefabs
- `CreateAssetMenu` attribute for easy creation — right-click → Create
- Don't modify at runtime in builds — changes not saved (except in editor)
- Great for config, item databases — reduces prefab duplication

## Common Mistakes
- `Find` methods every frame — cache references
- String comparisons for tags — use `CompareTag("Enemy")`, not `tag == "Enemy"`
- Physics queries allocate — use `NonAlloc` variants: `RaycastNonAlloc`
- UI anchors wrong — stretches unexpectedly on different resolutions
- `async/await` without context — use UniTask or careful error handling

「开发编程」分类下的热门技能

Github开发编程

使用 gh CLI 与 GitHub 交互,通过 gh issue、gh pr、gh run 和 gh api 管理议题、PR、CI 运行及高级查询。

↓ 38.7万★ 708Peter Steinberger
Multi Search Engine开发编程

Multi search engine integration with 16 engines (7 CN + 9 Global). Supports advanced search operators, time filters, site search, privacy engines, and Wolfra...

↓ 16.2万★ 763g_pyAng
Mcporter开发编程

使用 mcporter CLI 直接列出、配置、认证及调用 MCP 服务器/工具(支持 HTTP 或 stdio),涵盖临时服务器、配置编辑及 CLI/类型生成功能。

↓ 8.0万★ 204Peter Steinberger
Mermaid Diagram开发编程

生成有效的 Mermaid 图表,如流程图、时序图、思维导图、ER 图、用户旅程等。

↓ 7.3万★ 59pupujanet-eng
YouTube开发编程

通过托管 OAuth 集成 YouTube DataAPI,支持视频搜索、播放列表管理、频道数据访问及评论互动。当用户需要与 YouTube 交互时使用本技能。其他第三方应用请使用 api-gateway 技能(https://clawhub.ai/byungkyu/api-gateway)。

↓ 6.2万★ 145byungkyu
GitHub开发编程

GitHub API integration with managed OAuth. Access repositories, issues, pull requests, commits, branches, and users. Use this skill when users want to interact with GitHub repositories, manage issues and PRs, search code, or automate workflows. For other third party apps, use the api-gateway skill (

↓ 3.8万★ 53byungkyu
Code开发编程

覆盖规划、实现、验证与测试的编码工作流技能。

↓ 3.7万★ 66Iván
Docker Essentials开发编程

核心 Docker 命令和工作流程,包括容器管理、镜像操作和调试。

↓ 3.7万★ 42Arnarsson

Iván 的其他技能

数据月份:2026-09 · 下载/星标/安装数聚合自公开技能注册库(ClawHub、SkillHub),按月更新。口径说明见数据方法。