Unity
Avoid common Unity mistakes — lifecycle ordering, GetComponent caching, physics timing, and Unity's fake null.
от clawic★ 23 звезды на GitHub
Установить Unity в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
Lifecycle Order
AwakebeforeStart— use Awake for self-init, Start for cross-referencesOnEnablecalled beforeStart— but afterAwake- Order between scripts not guaranteed — use Script Execution Order if needed
Awakecalled even if disabled —Startonly when enabled
GetComponent Performance
GetComponentevery frame is slow — cache inAwakeorStartGetComponentInChildrensearches recursively — expensive on deep hierarchiesTryGetComponentreturns bool — avoids null check, slightly faster- Use
RequireComponentattribute — ensures dependency, documents requirement
Physics Timing
- Physics in
FixedUpdate, notUpdate— consistent regardless of framerate FixedUpdatecan run 0 or multiple times per frame — don't assume 1:1Rigidbody.MovePositionin FixedUpdate —transform.positionbypasses physicsTime.deltaTimein Update,Time.fixedDeltaTimein FixedUpdate — or just use deltaTime
Unity's Fake Null
- Destroyed objects aren't truly null —
== nullreturns true, but object exists - Null-conditional
?.doesn't work properly — use== nullorboolconversion Destroydoesn't happen immediately — object gone next frame- Use
DestroyImmediateonly in editor — causes issues in builds
Coroutines
StartCoroutineneeds MonoBehaviour active — disabled/destroyed stops coroutinesyield return nullwaits one frame —yield return new WaitForSeconds(1)for timeStopCoroutineneeds same method or Coroutine reference — string overload unreliable- Can't return values — use callbacks or set field in coroutine
Instantiate and Pooling
Instantiateis expensive — pool frequently created/destroyed objectsInstantiate(prefab, parent)sets parent — avoids extra SetParent callSetActive(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 publicpublicfields 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
CreateAssetMenuattribute 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
Findmethods every frame — cache references- String comparisons for tags — use
CompareTag("Enemy"), nottag == "Enemy" - Physics queries allocate — use
NonAllocvariants:RaycastNonAlloc - UI anchors wrong — stretches unexpectedly on different resolutions
async/awaitwithout context — use UniTask or careful error handling
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
- _meta.json
FAQ
Что делает скилл Unity?
Avoid common Unity mistakes — lifecycle ordering, GetComponent caching, physics timing, and Unity's fake null.
Как установить скилл Unity?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл Unity запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
theme-factory
AnthropicToolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
access
AnthropicManage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
configure
AnthropicSet up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
access
AnthropicManage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…