Command Palette

Search for a command to run...

Назад к скиллам
скилл № 58036

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от 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 FixedUpdate or use rb.linearVelocity (named velocity before Unity 6) / rb.MovePosition only in FixedUpdate. Changing transform in 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); set allowSceneActivation = false to hold activation until you are ready.
  • Use SceneManager.MergeScenes or 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.
  • GetComponentsInChildren only 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 + Jobs compiles 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
Полный SKILL.md на GitHub

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

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), без исполняемых скриптов.

Похожие скиллы

Сравнить unity с