unity
Use when the user asks about Unity 6, MonoBehaviour, the player loop, URP, HDRP, Addressables, Netcode for GameObjects, Unity physics or Unity Profiler…
от j4flmao★ 47 звёзд на GitHub
Установить unity в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
Unity Deep Engineering Guide
Purpose
Unity is a component-based game engine built around GameObjects, MonoBehaviours, and a C# scripting layer. Modern Unity adds Data-Oriented Technology Stack (DOTS/E.C.S.) and two Scriptable Render Pipelines (URP/HDRP). This guide covers how a lead engineer thinks about Unity: architecture, C# performance, data-oriented design, rendering, physics, multiplayer, and profiling.
Agent Protocol
Trigger
"unity", "unity 6", "monobehaviour", "URP", "HDRP", "addressables", "unity performance", "netcode for gameobjects".
Input Context
- Unity version (Unity 6.x)
- Render pipeline and target platforms
- Profiler capture if performance-related
Output Artifact
C# code, project/pipeline settings or a performance plan. No file unless requested.
Response Format
Unity: {6.x} Pipeline: {URP | HDRP}
Change: {what and why}
Code: {snippet}
Verify: {Profiler / Frame Debugger result}
1. Engine Architecture
Unity Player/Editor
Application (UnityEngine)
SceneManager -> load/unload Scenes (additive)
GameObject (identity + transform)
Component (MonoBehaviour, Renderer, Collider, Animator...)
PlayerLoop: (fixed update order, engine-driven)
PlayerLoop.SetPlayerLoop -> custom systems injected
Module systems: Physics (PhysX/Box2D), Audio (FMOD), UI (UGUI/UI Toolkit),
Rendering (URP/HDRP/Built-in), Input (new Input System)
1.1 The Player Loop & Update Order
Within one frame Unity calls systems in a fixed order:
void Update() // per rendered frame
void FixedUpdate() // fixed timestep: physics, network ticks (default 0.02s)
void LateUpdate() // camera follow, post-movement
Rules:
- Never move Rigidbody in Update(); move via
FixedUpdateor userb.linearVelocity(namedvelocitybefore Unity 6) /rb.MovePositiononly in FixedUpdate. Changingtransformin Update fights the physics solver. - Camera interpolation in LateUpdate.
- Scene load is synchronous unless using
Addressables/SceneManager.LoadSceneAsync.
1.2 Multiple Scenes (Additive Loading)
- Split levels into persistent + gameplay scenes; stream with
SceneManager.LoadSceneAsync(name, LoadSceneMode.Additive); setallowSceneActivation = falseto hold activation until you are ready. - Use
SceneManager.MergeScenesor DontDestroyOnLoad root object.
2. GameObject & Component Model
public class Health : MonoBehaviour {
public int maxHp = 100;
int current;
void OnEnable() { /* add self to manager lists */ }
void OnDisable() { /* remove self */ }
}
2.1 GetComponent Performance
GetComponent<T>() per frame per object is a hot-path mistake:
- Cache component references in
Awake()once. - Prefer
TryGetComponent. GetComponentsInChildrenonly at load or on structural change.- Hot update loops use managers (single static list of registered components), not per-object
Find.
2.2 FindFirstObjectByType / GameObject.Find
FindObjectOfType is deprecated (2023.1+) in favour of FindFirstObjectByType / FindAnyObjectByType. All of these scan the scene. They MUST not run on the per-frame path. For singletons, register in Awake, destroy in OnDestroy:
public static GameManager I; // global accessor
void Awake() { I = this; }
void OnDestroy() { if (I == this) I = null; }
3. The DOTS / ECS Stack
Unity DOTS replaces MonoBehaviours with archetype-based ECS:
// Component - plain struct, no MonoBehaviour
public struct Velocity : IComponentData { public float3 Value; }
// System
[BurstCompile]
partial struct MoveSystem : ISystem {
[BurstCompile]
public void OnUpdate(ref SystemState state) {
foreach (var (transform, v) in
SystemAPI.Query<RefRW<LocalTransform>, RefRO<Velocity>>())
{
transform.ValueRW.Position += v.ValueRO.Value * SystemAPI.Time.DeltaTime;
}
}
}
- Entities stored in archetypes (SoA per component) → cache-friendly.
Burst+Jobscompiles to native SIMD-optimized code.- SubScene baking: author GameObject scenes → baked entities at build.
When to use DOTS vs classic GameObjects
| Need | Path |
|---|---|
| 1000s of agents, bullets, particles | DOTS/ECS + Burst + Jobs |
| Rapid prototyping / small games | Classic GameObject/MonoBehaviours |
| UI, gameplay narrative, inventory | Classic (UGUI) |
| Massive open world streaming | DOTS SubScene streaming |
4. Rendering Pipelines
4.1 Choose the Pipeline
| Pipeline | Use |
|---|---|
| Built-in | Legacy, quick prototypes, simple mobile games |
| URP | Default for most new projects (mobile to PC/console); Forward, Forward+ or Deferred paths |
| HDRP | Film-grade lighting: deferred, ray tracing, volumetrics, high-end PC/console |
| Custom SRP | Only with a dedicated rendering team; URP/HDRP passes are extended via Render Graph (`ScriptableRenderPass |
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл unity?
Use when the user asks about Unity 6, MonoBehaviour, the player loop, URP, HDRP, Addressables, Netcode for GameObjects, Unity physics or Unity Profiler. Produces Unity project architecture, gameplay code and performance fixes. Not for DOTS, Entities and Burst in depth (use unity-csharp) or Unreal (use unreal).
Как установить скилл unity?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл unity запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
AnthropicGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
claude-api
AnthropicReference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
algorithmic-art
AnthropicCreating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
mcp-integration
AnthropicThis skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…