Iván

Unity

開発v1.0.0
作者:Iván更新日 2026-05-11unity@clawhub_ivangdavila/unity
コード生成バグ修正

AlphaMoatによると、2026-09時点でUnityのダウンロード数は3,823、スター数は5で、AIスキル全体5,078件中2,751位、開発では577件中359位です。

インストール数
368
ダウンロード数
3823
スター数
5
総合順位
#2,751
全体の上位 55% · 開発の上位 63%
プラットフォームインストール数ダウンロード数スター数コメント
ClawHub ↗9030123-
SkillHub ↗36838235—

プラットフォームごとに集計方法と集計時点が異なります。

このスキルでできること

参照のキャッシュ、初期化順、物理更新、破棄後の null 判定、コルーチン、プール、シリアライズ、ScriptableObjects を扱います。実際のプロジェクトと Unity の動作に照らすチェックリストとして使い、テストや最適化の実施済み証拠とはしません。

資料公開日 2026-10-27

できること

  • Unity スクリプトの初期化とメモリ割当を確認する

使う場面

  • ゲームコード、物理タイミング、オブジェクト再利用を見直すとき

プロンプト例

スキルのドキュメントをもとに生成した例であり、実際の実行結果ではありません。

この Unity コードの初期化、反復するコンポーネント検索、物理更新、破棄済みオブジェクトの判定を確認して。

月次の推移

ダウンロード数3823
1564277739902026-03 · ダウンロード数 17312026-05 · ダウンロード数 22532026-06 · ダウンロード数 24142026-07 · ダウンロード数 27162026-08 · ダウンロード数 30002026-09 · ダウンロード数 382326-0326-09
スター数5
3452026-03 · スター数 32026-05 · スター数 32026-06 · スター数 32026-07 · スター数 42026-08 · スター数 42026-09 · スター数 526-0326-09

2026-09 から集計方法を変更し、同名スキルを作者ごとに分けて集計し、全スキルを対象にしました。破線は変更前の月で、変更後のデータとは直接比較せず、変更をまたぐ増減も計算していません。

月ダウンロード数前月比スター数
2026-093823—5
2026-083000+10.5%4
2026-072716+12.5%4
2026-062414+7.1%3
2026-052253—3
2026-031731—3

SKILL.md 原文

作者が公開した元のファイルをテキストのまま表示しています。AlphaMoat による編集や審査はしていません。リンクはクリックできません。コマンドは内容を確認してから実行してください。取得日 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

開発の人気スキル

Ivánのその他のスキル

データ月:2026-09 · ダウンロード数、スター数、インストール数は公開スキルレジストリ(ClawHub、SkillHub)から月単位で集計しています。詳しくはデータの方法論をご覧ください。