[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M79NSMARH0Q7SSN6N56HHAZD":3,"skill-same:01M79NSMARH0Q7SSN6N56HHAZD":55},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":29,"commitSha":30,"skillDirectory":5,"forksCount":14,"repositoryHtmlUrl":31,"repositoryHomepageUrl":6,"ownerHtmlUrl":32,"ownerBlogUrl":6,"ownerDescription":33,"updatedAt":34,"install":35,"resources":48},"01M79NSMARH0Q7SSN6N56HHAZD","unity-csharp-scripting",null,"Write Unity 6 C# gameplay scripts: the MonoBehaviour lifecycle (Awake\u002FOnEnable\u002FStart\u002FUpdate\u002FFixedUpdate\u002FLateUpdate), GameObject and component access, coroutines, and Inspector serialization. Use when creating or editing .cs scripts in a Unity project, or when the user mentions MonoBehaviour, Start\u002FUpdate, GetComponent, SerializeField, coroutines, or \"Unity script\".","mistervaibhav\u002Fskills","mistervaibhav","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F41189028?v=4","01M79KACH05EG9FMM6DQVHAVK9","Vaibhav Singh","01M79KACJB3431Y8CFJQ02MTTM",0,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Fmistervaibhav\u002Fskills\u002Fblob\u002Fmain\u002Funity-csharp-scripting\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: unity-csharp-scripting\ndescription: >\n  Write Unity 6 C# gameplay scripts: the MonoBehaviour lifecycle\n  (Awake\u002FOnEnable\u002FStart\u002FUpdate\u002FFixedUpdate\u002FLateUpdate), GameObject and component\n  access, coroutines, and Inspector serialization. Use when creating or editing .cs\n  scripts in a Unity project, or when the user mentions MonoBehaviour, Start\u002FUpdate,\n  GetComponent, SerializeField, coroutines, or \"Unity script\".\nlicense: Apache-2.0\ncompatibility: Unity 6 (6000.0 LTS); also valid for 2022 LTS\nmetadata:\n  engine: unity\n  category: unity\n  difficulty: beginner\n---\n\n# Unity C# Scripting (MonoBehaviour)\n\nWrite correct, idiomatic gameplay scripts in Unity 6. Get the lifecycle, component\naccess, serialization, and coroutines right so behaviour is deterministic and the\nInspector stays useful. Targets **Unity 6 (6000.0 LTS)**, C# \u002F .NET Standard 2.1.\n\n## When to use\n\n- Use when authoring or fixing a `MonoBehaviour`: choosing the right lifecycle callback,\n  reading\u002Fcaching components, exposing fields to the Inspector, or running timed logic\n  with coroutines.\n- Use when the project has `*.cs` files, an `Assembly-CSharp` or `*.asmdef`, and a\n  `ProjectSettings\u002F` folder.\n\n**When *not* to use:** moving rigidbodies \u002F collision response → `unity-physics`; reading\nplayer input → `unity-input-system`; shared data assets \u002F config → `unity-scriptableobjects`;\nAnimator parameters → `unity-animation`. This skill owns the *script lifecycle and C#\nplumbing*, not those subsystems.\n\n## Core workflow\n\n1. **Pick the callback by purpose, not habit.** `Awake` (cache references, runs once on\n   load), `OnEnable` (subscribe to events), `Start` (init that depends on other objects'\n   `Awake`), `Update` (per-frame logic\u002Finput polling), `FixedUpdate` (physics), `LateUpdate`\n   (camera follow after movement), `OnDisable`\u002F`OnDestroy` (unsubscribe\u002Fcleanup).\n2. **Cache component lookups in `Awake`** — never call `GetComponent` every frame.\n3. **Expose tunables with `[SerializeField] private`**, not public fields, so other code\n   can't mutate them but designers can edit them in the Inspector.\n4. **Scale per-frame values by `Time.deltaTime`** in `Update` (and `Time.fixedDeltaTime`\n   semantics are automatic in `FixedUpdate`).\n5. **Use coroutines for time-sequenced logic** (delays, tweens, \"do X then wait then Y\");\n   start them with `StartCoroutine` and stop them deterministically.\n6. **Verify in Play mode**: check the Console for null-reference exceptions, confirm values\n   in the Inspector update as expected, and watch the Profiler if `Update` is hot.\n\n## Patterns\n\n### 1. Lifecycle + cached components (the canonical skeleton)\n\n```csharp\nusing UnityEngine;\n\n[RequireComponent(typeof(Rigidbody))]      \u002F\u002F auto-adds the dependency, prevents null refs\npublic class PlayerController : MonoBehaviour\n{\n    [SerializeField] private float moveSpeed = 6f;   \u002F\u002F editable in Inspector, private in code\n    private Rigidbody _rb;                            \u002F\u002F cached, not fetched per frame\n\n    private void Awake() => _rb = GetComponent\u003CRigidbody>();  \u002F\u002F cache once on load\n\n    private void Update()\n    {\n        \u002F\u002F Per-frame, non-physics work. Scale by deltaTime so it is frame-rate independent.\n        transform.Rotate(0f, 90f * Time.deltaTime, 0f);\n    }\n\n    private void FixedUpdate()\n    {\n        \u002F\u002F Physics work belongs here (fixed timestep). See the unity-physics skill.\n        _rb.MovePosition(_rb.position + transform.forward * moveSpeed * Time.fixedDeltaTime);\n    }\n}\n```\n\n### 2. Safe component access with `TryGetComponent`\n\n```csharp\n\u002F\u002F Avoids allocating a null and is clearer than GetComponent + null check.\nif (other.TryGetComponent\u003CHealth>(out var health))\n    health.Apply(-10);\n```\n\n### 3. Serialization that shows up correctly in the Inspector\n\n```csharp\n[SerializeField, Range(0f, 1f)] private float volume = 0.8f;  \u002F\u002F slider\n[SerializeField] private string playerName = \"Hero\";          \u002F\u002F private but serialized\n\n[System.Serializable]                 \u002F\u002F REQUIRED for a plain class to serialize\u002Fshow\npublic class Stats { public int hp = 100; public int mana = 50; }\n\n[SerializeField] private Stats stats = new();  \u002F\u002F nested struct-like data in the Inspector\n```\n\n### 4. Coroutines for time-sequenced logic\n\n```csharp\nprivate void Start() => StartCoroutine(FlashThenHide());\n\nprivate System.Collections.IEnumerator FlashThenHide()\n{\n    yield return new WaitForSeconds(0.5f);   \u002F\u002F wait half a second of game time\n    GetComponent\u003CRenderer>().enabled = false;\n    yield return null;                       \u002F\u002F resume next frame\n}\n```\n\n## Pitfalls\n\n- **`GetComponent` in `Update`** — it searches every frame and tanks performance. Cache the\n  reference in `Awake`\u002F`Start`.\n- **Physics in `Update`** — moving a `Rigidbody` with forces or `MovePosition` outside\n  `FixedUpdate` causes jitter and timestep-dependent behaviour. Read input in `Update`,\n  apply physics in `FixedUpdate`.\n- **Relying on `Start` order across objects** — `Start` runs after *all* `Awake`s, but order\n  among `Start`s is undefined. Do cross-object wiring in `Start`, self-setup in `Awake`.\n- **`public` fields just to show them in the Inspector** — that also lets any script mutate\n  them. Use `[SerializeField] private` instead.\n- **`gameObject.tag == \"Enemy\"`** allocates a string and is slower; use\n  `gameObject.CompareTag(\"Enemy\")`.\n- **Coroutines stop when the GameObject is disabled** — a disabled object's coroutines are\n  killed; re-`StartCoroutine` in `OnEnable` if it must survive toggling.\n- **`Update` never runs before `Start`, but the *first* `Update` can run on the same\n  frame as `Start`** — guard against not-yet-initialised fields if you split setup oddly.\n\n## References\n\n- For the full event-execution-order table and advanced coroutine patterns (custom\n  `CustomYieldInstruction`, stopping by handle, `WaitUntil`\u002F`WaitWhile`), read\n  `references\u002Flifecycle-and-coroutines.md`.\n- Primary docs: Unity Manual \"Event function execution order\"\n  (`https:\u002F\u002Fdocs.unity3d.com\u002FManual\u002Fexecution-order.html`) and `ScriptReference\u002FMonoBehaviour`.\n\n## Related skills\n\n- `unity-physics` — `Rigidbody`, collisions, and `FixedUpdate` motion.\n- `unity-input-system` — reading player input into these scripts.\n- `unity-scriptableobjects` — sharing data\u002Fconfig between scripts without singletons.\n","# Unity C# Scripting (MonoBehaviour)\n\nWrite correct, idiomatic gameplay scripts in Unity 6. Get the lifecycle, component\naccess, serialization, and coroutines right so behaviour is deterministic and the\nInspector stays useful. Targets **Unity 6 (6000.0 LTS)**, C# \u002F .NET Standard 2.1.\n\n## When to use\n\n- Use when authoring or fixing a `MonoBehaviour`: choosing the right lifecycle callback,\n  reading\u002Fcaching components, exposing fields to the Inspector, or running timed logic\n  with coroutines.\n- Use when the project has `*.cs` files, an `Assembly-CSharp` or `*.asmdef`, and a\n  `ProjectSettings\u002F` folder.\n\n**When *not* to use:** moving rigidbodies \u002F collision response → `unity-physics`; reading\nplayer input → `unity-input-system`; shared data assets \u002F config → `unity-scriptableobjects`;\nAnimator parameters → `unity-animation`. This skill owns the *script lifecycle and C#\nplumbing*, not those subsystems.\n\n## Core workflow\n\n1. **Pick the callback by purpose, not habit.** `Awake` (cache references, runs once on\n   load), `OnEnable` (subscribe to events), `Start` (init that depends on other objects'\n   `Awake`), `Update` (per-frame logic\u002Finput polling), `FixedUpdate` (physics), `LateUpdate`\n   (camera follow after movement), `OnDisable`\u002F`OnDestroy` (unsubscribe\u002Fcleanup).\n2. **Cache component lookups in `Awake`** — never call `GetComponent` every frame.\n3. **Expose tunables with `[SerializeField] private`**, not public fields, so other code\n   can't mutate them but designers can edit them in the Inspector.\n4. **Scale per-frame values by `Time.deltaTime`** in `Update` (and `Time.fixedDeltaTime`\n   semantics are automatic in `FixedUpdate`).\n5. **Use coroutines for time-sequenced logic** (delays, tweens, \"do X then wait then Y\");\n   start them with `StartCoroutine` and stop them deterministically.\n6. **Verify in Play mode**: check the Console for null-reference exceptions, confirm values\n   in the Inspector update as expected, and watch the Profiler if `Update` is hot.\n\n## Patterns\n\n### 1. Lifecycle + cached components (the canonical skeleton)\n\n```csharp\nusing UnityEngine;\n\n[RequireComponent(typeof(Rigidbody))]      \u002F\u002F auto-adds the dependency, prevents null refs\npublic class PlayerController : MonoBehaviour\n{\n    [SerializeField] private float moveSpeed = 6f;   \u002F\u002F editable in Inspector, private in code\n    private Rigidbody _rb;                            \u002F\u002F cached, not fetched per frame\n\n    private void Awake() => _rb = GetComponent\u003CRigidbody>();  \u002F\u002F cache once on load\n\n    private void Update()\n    {\n        \u002F\u002F Per-frame, non-physics work. Scale by deltaTime so it is frame-rate independent.\n        transform.Rotate(0f, 90f * Time.deltaTime, 0f);\n    }\n\n    private void FixedUpdate()\n    {\n        \u002F\u002F Physics work belongs here (fixed timestep). See the unity-physics skill.\n        _rb.MovePosition(_rb.position + transform.forward * moveSpeed * Time.fixedDeltaTime);\n    }\n}\n```\n\n### 2. Safe component access with `TryGetComponent`\n\n```csharp\n\u002F\u002F Avoids allocating a null and is clearer than GetComponent + null check.\nif (other.TryGetComponent\u003CHealth>(out var health))\n    health.Apply(-10);\n```\n\n### 3. Serialization that shows up correctly in the Inspector\n\n```csharp\n[SerializeField, Range(0f, 1f)] private float volume = 0.8f;  \u002F\u002F slider\n[SerializeField] private string playerName = \"Hero\";          \u002F\u002F private but serialized\n\n[System.Serializable]                 \u002F\u002F REQUIRED for a plain class to serialize\u002Fshow\npublic class Stats { public int hp = 100; public int mana = 50; }\n\n[SerializeField] private Stats stats = new();  \u002F\u002F nested struct-like data in the Inspector\n```\n\n### 4. Coroutines for time-sequenced logic\n\n```csharp\nprivate void Start() => StartCoroutine(FlashThenHide());\n\nprivate System.Collections.IEnumerator FlashThenHide()\n{\n    yield return new WaitForSeconds(0.5f);   \u002F\u002F wait half a second of game time\n    GetComponent\u003CRenderer>().enabled = false;\n    yield return null;                       \u002F\u002F resume next frame\n}\n```\n\n## Pitfalls\n\n- **`GetComponent` in `Update`** — it searches every frame and tanks performance. Cache the\n  reference in `Awake`\u002F`Start`.\n- **Physics in `Update`** — moving a `Rigidbody` with forces or `MovePosition` outside\n  `FixedUpdate` causes jitter and timestep-dependent behaviour. Read input in `Update`,\n  apply physics in `FixedUpdate`.\n- **Relying on `Start` order across objects** — `Start` runs after *all* `Awake`s, but order\n  among `Start`s is undefined. Do cross-object wiring in `Start`, self-setup in `Awake`.\n- **`public` fields just to show them in the Inspector** — that also lets any script mutate\n  them. Use `[SerializeField] private` instead.\n- **`gameObject.tag == \"Enemy\"`** allocates a string and is slower; use\n  `gameObject.CompareTag(\"Enemy\")`.\n- **Coroutines stop when the GameObject is disabled** — a disabled object's coroutines are\n  killed; re-`StartCoroutine` in `OnEnable` if it must survive toggling.\n- **`Update` never runs before `Start`, but the *first* `Update` can run on the same\n  frame as `Start`** — guard against not-yet-initialised fields if you split setup oddly.\n\n## References\n\n- For the full event-execution-order table and advanced coroutine patterns (custom\n  `CustomYieldInstruction`, stopping by handle, `WaitUntil`\u002F`WaitWhile`), read\n  `references\u002Flifecycle-and-coroutines.md`.\n- Primary docs: Unity Manual \"Event function execution order\"\n  (`https:\u002F\u002Fdocs.unity3d.com\u002FManual\u002Fexecution-order.html`) and `ScriptReference\u002FMonoBehaviour`.\n\n## Related skills\n\n- `unity-physics` — `Rigidbody`, collisions, and `FixedUpdate` motion.\n- `unity-input-system` — reading player input into these scripts.\n- `unity-scriptableobjects` — sharing data\u002Fconfig between scripts without singletons.\n",{"name":5,"license":15,"metadata":24,"description":27,"compatibility":28},{"engine":25,"category":25,"difficulty":26},"unity","beginner","Write Unity 6 C# gameplay scripts: the MonoBehaviour lifecycle (Awake\u002FOnEnable\u002FStart\u002FUpdate\u002FFixedUpdate\u002FLateUpdate), GameObject and component access, coroutines, and Inspector serialization. Use when creating or editing .cs scripts in a Unity project, or when the user mentions MonoBehaviour, Start\u002FUpdate, GetComponent, SerializeField, coroutines, or \"Unity script\".\n","Unity 6 (6000.0 LTS); also valid for 2022 LTS","main","6d4e3296d58b2720c5b1026197cd069b1dde4789","https:\u002F\u002Fgithub.com\u002Fmistervaibhav\u002Fskills","https:\u002F\u002Fgithub.com\u002Fmistervaibhav","Software Engineer","2026-07-24 17:16:42",{"source":8,"skillName":5,"commands":36,"prompt":46,"zipAvailable":47},[37,40,43],{"tool":38,"command":39},"npx","npx skills add mistervaibhav\u002Fskills --skill unity-csharp-scripting",{"tool":41,"command":42},"bunx","bunx skills add mistervaibhav\u002Fskills --skill unity-csharp-scripting",{"tool":44,"command":45},"pnpm","pnpm dlx skills add mistervaibhav\u002Fskills --skill unity-csharp-scripting","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fmistervaibhav\u002Fskills\u002Fblob\u002Fmain\u002Funity-csharp-scripting\u002FSKILL.md",true,[49],{"path":50,"resourceType":51,"resourceTypeDesc":52,"sizeBytes":53,"sourceHtmlUrl":54},"references\u002Flifecycle-and-coroutines.md","REFERENCE","参考文档",4251,"https:\u002F\u002Fgithub.com\u002Fmistervaibhav\u002Fskills\u002Fblob\u002Fmain\u002Funity-csharp-scripting\u002Freferences\u002Flifecycle-and-coroutines.md",[56,64,72,80,87,94],{"skillNo":57,"name":58,"nameZh":6,"description":59,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":60,"sourceHtmlUrl":61,"categories":62,"keywords":63,"publishedAt":19},"01M79NZDV5781GA6SJMN1QPXB4","webapp-testing","Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing browser screenshots, and viewing browser logs.","https:\u002F\u002Fgithub.com\u002Fmistervaibhav\u002Fskills\u002Fblob\u002Fmain\u002Fwebapp-testing\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fmistervaibhav\u002Fskills\u002Fblob\u002Fmain\u002Fwebapp-testing\u002FSKILL.md",[],[],{"skillNo":65,"name":66,"nameZh":6,"description":67,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":68,"licenseFileUrl":6,"sourceHtmlUrl":69,"categories":70,"keywords":71,"publishedAt":19},"01M79NZ8SEVWT4WYD49BV980YW","web-typography","Select, pair, and implement typefaces for web projects. Use when the user mentions \"font pairing\", \"which typeface\", \"line height\", \"responsive typography\", \"web font loading\", or \"type hierarchy\". Covers readability evaluation, CSS implementation, and performance optimization. For overall UI design systems, see refactoring-ui. For dramatic typographic experiences, see top-design.","MIT","https:\u002F\u002Fgithub.com\u002Fmistervaibhav\u002Fskills\u002Fblob\u002Fmain\u002Fweb-typography\u002FSKILL.md",[],[],{"skillNo":73,"name":74,"nameZh":6,"description":75,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":68,"licenseFileUrl":76,"sourceHtmlUrl":77,"categories":78,"keywords":79,"publishedAt":19},"01M79NYVQS5NYHH36NXF2AHP8B","web-haptics","Add haptic feedback to web apps using the web-haptics library. Use when building mobile-facing UIs that need tactile feedback on buttons, toggles, forms, pickers, and other interactive elements.","https:\u002F\u002Fgithub.com\u002Fmistervaibhav\u002Fskills\u002Fblob\u002Fmain\u002Fweb-haptics\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fmistervaibhav\u002Fskills\u002Fblob\u002Fmain\u002Fweb-haptics\u002FSKILL.md",[],[],{"skillNo":81,"name":82,"nameZh":6,"description":83,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":84,"categories":85,"keywords":86,"publishedAt":19},"01M79NY8AMC62DDRSH21WKXJVE","visual-novel","Build a visual novel: a branching script, character and background display, a text box with choices, save\u002Fload, backlog, and skip\u002Fauto. Use for a VN, dating sim, or branching story game.","https:\u002F\u002Fgithub.com\u002Fmistervaibhav\u002Fskills\u002Fblob\u002Fmain\u002Fvisual-novel\u002FSKILL.md",[],[],{"skillNo":88,"name":89,"nameZh":6,"description":90,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":68,"licenseFileUrl":6,"sourceHtmlUrl":91,"categories":92,"keywords":93,"publishedAt":19},"01M79NWFM5R9QC9Y2AT40EHF44","ux-heuristics","Evaluate and improve interface usability using heuristic analysis. Use when the user mentions \"usability audit\", \"UX review\", \"users are confused\", \"heuristic evaluation\", \"form usability\", or \"navigation problems\". Covers Nielsen's 10 heuristics, severity ratings, and information architecture. For visual design fixes, see refactoring-ui. For conversion-focused audits, see cro-methodology.","https:\u002F\u002Fgithub.com\u002Fmistervaibhav\u002Fskills\u002Fblob\u002Fmain\u002Fux-heuristics\u002FSKILL.md",[],[],{"skillNo":95,"name":96,"nameZh":6,"description":97,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":98,"categories":99,"keywords":100,"publishedAt":19},"01M79NVSG7AB3MSFT8Y6EEHG1B","unreal-packaging","Package and ship an Unreal Engine 5 project: the Platforms menu Package Project flow, build configurations (Development vs Shipping), cooking content, packaging settings and the Game Default Map, and command-line builds with RunUAT BuildCookRun. Use when packaging a build, making a shipping build, cooking content, configuring packaging settings, or when the user mentions package Unreal, cook content, shipping build, or BuildCookRun.","https:\u002F\u002Fgithub.com\u002Fmistervaibhav\u002Fskills\u002Fblob\u002Fmain\u002Funreal-packaging\u002FSKILL.md",[],[]]