Token导航 LogoToken导航TokenDH.com
研究检索只读github未标认证来源可访问许可证需确认审计通过

unity-csharpUnity csharp 搜索

Agent Skill

unity-csharp 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

784

周安装

33

GitHub Stars

1

下载量

275
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:unity-csharp(Unity csharp 搜索)
来源仓库:https://github.com/alexanderstephenthompson/claude-hub
仓库路径:skills/unity-csharp
安装命令:
npx skills add https://github.com/alexanderstephenthompson/claude-hub --skill unity-csharp
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/alexanderstephenthompson/claude-hub --skill unity-csharp

简介

用于 Unity C# 开发相关的信息查找、检索和筛选,适合在 Codex、Claude、Cursor、Gemini CLI 中快速定位代码示例或最佳实践。

  • 适用于需要根据关键词或开发场景定位候选结果时使用。
  • 通过 npx skills add 命令从 GitHub 仓库安装并使用。
  • 安装前建议确认权限范围和维护状态,避免触发不必要的联网或文件操作。
  • unity-csharp 属于研究检索类 Skill,可作为该场景下的辅助能力补充。

SKILL.md

Unity C# Skill

Version: 2.0 Stack: Unity, C#

Patterns for writing clean, performant Unity C# code. Includes VR/mobile optimization.

Scope and Boundaries

This skill covers:

  • MonoBehaviour lifecycle and component architecture
  • Unity-specific C# patterns (caching, events, coroutines, null safety)
  • Performance optimization (draw calls, batching, LODs, pooling)
  • VR/mobile performance targets and profiling
  • ScriptableObject usage

Defers to other skills:

  • vrc-udon: VRChat-specific scripting (UdonSharp)
  • vrc-worlds: VRChat world setup and limits
  • vrc-avatars: VRChat avatar setup and limits

Use this skill when: Writing C# scripts for Unity, or optimizing Unity performance for VR/mobile.


Core Principles

  1. Composition Over Inheritance — Small, focused components.
  2. Avoid Update() When Possible — Event-driven or coroutines instead.
  3. Cache References — GetComponent is expensive; cache in Awake.
  4. ScriptableObjects for Data — Decouple data from behavior.
  5. Null-Safe Access — Unity objects can be destroyed at any time.
  6. Measure First — Profile before optimizing; gut feelings lie.
  7. Batch Aggressively — Same material = potential batch. Draw calls matter most in VR.

Patterns

Reference Caching

public class PlayerController : MonoBehaviour
{
    private Rigidbody _rb;
    private Animator _animator;

    [SerializeField] private Transform _cameraTarget;

    private void Awake()
    {
        _rb = GetComponent<Rigidbody>();
        _animator = GetComponent<Animator>();
    }

    private void FixedUpdate()
    {
        _rb.AddForce(Vector3.up);
    }
}

Event System (ScriptableObject)

[CreateAssetMenu(menuName = "Events/Game Event")]
public class GameEvent : ScriptableObject
{
    private readonly List<GameEventListener> _listeners = new();

    public void Raise()
    {
        for (int i = _listeners.Count - 1; i >= 0; i--)
            _listeners[i].OnEventRaised();
    }

    public void RegisterListener(GameEventListener listener) =>
        _listeners.Add(listener);

    public void UnregisterListener(GameEventListener listener) =>
        _listeners.Remove(listener);
}

public class GameEventListener : MonoBehaviour
{
    [SerializeField] private GameEvent _event;
    [SerializeField] private UnityEvent _response;

    private void OnEnable() => _event.RegisterListener(this);
    private void OnDisable() => _event.UnregisterListener(this);
    public void OnEventRaised() => _response.Invoke();
}

Null-Safe Pattern

// Unity overloads == for destroyed objects
if (_target != null)
{
    _target.DoSomething();
}

// Best: explicit destroyed check
if (_target != null && !_target.Equals(null))
{
    _target.DoSomething();
}

Coroutine Pattern

private IEnumerator FadeOut(float duration)
{
    float elapsed = 0f;
    Color startColor = _renderer.material.color;

    while (elapsed < duration)
    {
        elapsed += Time.deltaTime;
        float t = elapsed / duration;
        _renderer.material.color = Color.Lerp(startColor, Color.clear, t);
        yield return null;
    }

    gameObject.SetActive(false);
}

Object Pooling

public class ObjectPool : MonoBehaviour
{
    [SerializeField] private GameObject _prefab;
    [SerializeField] private int _initialSize = 10;

    private Queue<GameObject> _pool = new();

    private void Awake()
    {
        for (int i = 0; i < _initialSize; i++)
        {
            var obj = Instantiate(_prefab);
            obj.SetActive(false);
            _pool.Enqueue(obj);
        }
    }

    public GameObject Get()
    {
        if (_pool.Count == 0)
            return Instantiate(_prefab);

        var pooled = _pool.Dequeue();
        pooled.SetActive(true);
        return pooled;
    }

    public void Return(GameObject obj)
    {
        obj.SetActive(false);
        _pool.Enqueue(obj);
    }
}

Static Batching

gameObject.isStatic = true;

// Or specific flags
GameObjectUtility.SetStaticEditorFlags(gameObject,
    StaticEditorFlags.BatchingStatic |
    StaticEditorFlags.OcclusionStatic);

VR Performance Targets

MetricQuest 2Quest 3PC VR
Draw Calls<100<150<200
Triangles<100K<150K<1M
Frame Time<14ms (72fps)<11ms (90fps)<11ms (90fps)
Texture Memory<200MB<500MB<1GB

LOD Configuration

LOD 0: 100% triangles (0-10m)
LOD 1: 50% triangles (10-25m)
LOD 2: 25% triangles (25-50m)
Culled: 0 triangles (50m+)

Material Atlasing

Before: 20 objects x 20 materials = 20 draw calls (no batching)
After:  20 objects x 1 atlas material = 1 draw call (batched)

Anti-Patterns

Anti-PatternProblemFix
GetComponent in UpdateExpensive every frameCache in Awake
Find or FindObjectOfTypeSlow, fragileInject references or use events
Heavy Update loopsPerformance drainUse events, coroutines, or FixedUpdate
String comparisons for tagsTypo-prone, slowUse CompareTag or constants
Public fields for everythingNo encapsulationUse [SerializeField] private
Unique material per objectNo batching possibleShare materials, use atlases
No LODsFull detail at any distanceAdd LOD groups
Instantiate/Destroy in gameplayGC spikes, stuttersObject pooling
Realtime lights everywhereExpensive shadowsBake lighting, limit realtime
No occlusion cullingRender hidden objectsBake occlusion data

Checklist

Code Quality

  • References cached in Awake
  • No GetComponent in Update/FixedUpdate
  • No Find methods in runtime code
  • ScriptableObjects for shared data
  • Events for decoupled communication
  • Null checks for destroyable objects

Performance

  • Static objects marked static
  • Materials shared where possible
  • Texture atlases for small props
  • LOD groups on significant meshes
  • Occlusion culling baked
  • Object pooling for spawned objects
  • Lighting baked (not all realtime)

Profiling

  • Frame Debugger checked for draw calls
  • Profiler run for CPU spikes
  • Memory Profiler checked for leaks
  • Tested on target device (not just editor)

References

  • references/lifecycle.md — MonoBehaviour lifecycle and execution order
  • references/profiling.md — Unity Profiler usage and interpretation

Assets

  • assets/component-checklist.md — Unity component design checklist
  • assets/vr-performance-limits.md — VR platform performance limits and targets

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Claude

33.95%
按下载量换算93

Codex

33.63%
按下载量换算92

Cursor

17.47%
按下载量换算48

Gemini CLI

9.89%
按下载量换算27

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

只读

该 Skill 主要提供规则、说明或参考内容,本身偏只读;真正读写文件、联网或执行命令仍取决于宿主 Agent 的任务。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills