unity-csharp-scripting
БесплатноЗапускает вложенные скриптыНе проверенWrites and fixes Unity 6.3 LTS C# gameplay scripts: MonoBehaviour lifecycle, serialization, .meta/GUID discipline and command-line tests. Use for new or…
от gamedev-skills★ 12 656 звёзд на GitHubОб этом скилле
Unity C# Scripting (MonoBehaviour)
Write correct gameplay scripts for Unity 6.3 LTS (6000.3), C# 9 on .NET Standard 2.1, keep the
project's .meta files intact, and prove the result compiles and behaves without opening the
Editor by hand.
When to use
- Authoring or fixing a
MonoBehaviour: lifecycle callbacks, component references, serialized fields, coroutines,asyncwithAwaitable. - Creating, moving, renaming or deleting scripts and assets from the file system.
- Compiling or testing a Unity project from a terminal or CI, for any Unity skill.
- The project has
Assets/,ProjectSettings/and*.csfiles.
When not to use: rigidbodies and collision response → unity-physics; reading player
input → unity-input-system; shared data assets and config → unity-scriptableobjects;
Animator parameters → unity-animation; building players → unity-build-pipeline.
Workflow
- Read the project's versions first.
ProjectSettings/ProjectVersion.txtgives the Editor version;Packages/manifest.jsonthe packages; any*.asmdeffiles tell you which assembly a new script lands in. Keep the project's version unless asked to upgrade. On a Unity 6 Editor other than 6000.3, check any API you are unsure of in that version's docs: grephttps://docs.unity3d.com/<major.minor>/Documentation/ScriptReference/xrefmap.ymlfor the member, then read its page underhttps://docs.unity.com/en-us/engine/<major.minor>/script-reference/(for exampleunityengine/rigidbody2d/addforce.md). Before Unity 6, readhttps://docs.unity3d.com/<major.minor>/Documentation/ScriptReference/<Class>.<Member>.htmlinstead. Package docs are inLibrary/PackageCache/<package>@*/Documentation~/. - Pick the callback by purpose.
Awakecaches references to its own components;OnEnable/OnDisablesubscribe and unsubscribe;Startwires things that depend on other objects'Awake;FixedUpdateis physics;LateUpdatefollows movement (cameras). - Expose tunables with
[SerializeField] privateso designers can edit them and other code cannot. A plain class needs[System.Serializable]to show up. - Move every file with its
.meta. A.metaholds the asset's GUID; a new.metameans a new GUID and every reference to the old one shows "Missing script". A brand-new file needs no.meta: Unity writes one on the next import. Keep eachMonoBehaviourorScriptableObjectclass in a file of the same name. - Run the checker:
python scripts/check_unity_project.py <project-dir>(--jsonfor machine-readable output). Fix everyERROR(duplicate or malformed GUIDs, files moved without their.meta, missing script references) and re-run until it exits 0. Run it from this skill's directory or resolve the installed path first; it needs Python 3.10+ only, reads text-serialized assets and never writes.--helplists the checks and exit codes. - Compile. With the Unity CLI and a ready Editor,
unity recompile --project-path <project>; otherwise a batch-mode import andgrep -E "error CS[0-9]{4}"on its log. - Prove the behavior with an EditMode or PlayMode test, or by reading the value back from
the running Editor with
unity command script eval. Readreferences/agent-checks.mdfor the exact commands, the test.asmdefand how to read the results. Report which checks ran and which could not.
Patterns
1. Serialized fields that survive refactors
using UnityEngine;
using UnityEngine.Serialization;
public class Turret : MonoBehaviour
{
[SerializeField, Range(0.1f, 5f)] private float fireInterval = 0.5f;
// Renamed from "range": without this attribute every scene and prefab loses the value.
[FormerlySerializedAs("range")]
[SerializeField] private float maxRange = 12f;
[System.Serializable]
public class Stats { public int hp = 100; public int armor = 0; }
[SerializeField] private Stats stats = new();
}
2. A coroutine you can stop exactly
private Coroutine _spawnLoop;
private void OnEnable() => _spawnLoop = StartCoroutine(SpawnLoop());
private void OnDisable() { if (_spawnLoop != null) StopCoroutine(_spawnLoop); }
private System.Collections.IEnumerator SpawnLoop()
{
var wait = new WaitForSeconds(1f); // allocate once, reuse
while (true) { Spawn(); yield return wait; }
}
private void Spawn() { }
For async/await with Awaitable, the full execution order and custom yield
instructions, read references/lifecycle-and-coroutines.md.
Gotchas
?.and??on a destroyed object. Unity overrides==so a destroyed object equalsnull, but?.,??andis nullskip that override and see a live reference. Useif (target)ortarget == nullfor anything derived fromUnityEngine.Object.- Renaming a serialized field wipes its saved values. Add
[FormerlySerializedAs("old")](namespace `UnityEngine.Serial
Установить unity-csharp-scripting в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл unity-csharp-scripting?
Writes and fixes Unity 6.3 LTS C# gameplay scripts: MonoBehaviour lifecycle, serialization, .meta/GUID discipline and command-line tests. Use for new or renamed .cs files, "Missing script" or a field missing from the Inspector. Not for physics (`unity-physics`), input (`unity-input-system`), data assets (`unity-scriptableobjects`) or builds (`unity-build-pipeline`).
Как установить скилл unity-csharp-scripting?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл unity-csharp-scripting запускает скрипты?
Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.
Похожие скиллы
skill-creator
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
от Anthropicdiscernment-nudge
After you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
от Anthropicdata-consolidate
Joins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
от Anthropicinspection-to-capa
Runs the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…
от Anthropic