بنقرة واحدة
unity-csharp-style
C# coding style for Unity projects. Use when writing or editing C# (.cs) files in a Unity project.
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
C# coding style for Unity projects. Use when writing or editing C# (.cs) files in a Unity project.
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
Use when interacting with a running Unity Editor instance — sending commands, checking editor connection status, installing the Pipeline package, or evaluating C# expressions in the editor.
Use when installing, uninstalling, or upgrading Unity editors, adding or listing modules, or browsing available Unity releases.
Use for general Unity CLI operations — list or open projects, list installed editors, read CLI logs, or any other Unity CLI task not covered by a more specific skill (unity-cli-install, unity-cli-build, unity-cli-pipeline).
Use when creating or editing Unity Shader Graph assets programmatically (Unity 6.5+) — authoring custom nodes from HLSL via the Shader Function Reflection API, generating .shadergraph files, or wiring nodes by editing the graph JSON.
Use when reading the Unity Editor Console (log/warning/error entries) or detecting compile errors (C#/Burst, shader, compute shader) from a connected editor via the Pipeline package.
Use when creating a new minimal Unity project.
| name | unity-csharp-style |
| description | C# coding style for Unity projects. Use when writing or editing C# (.cs) files in a Unity project. |
A style guide for writing C# in Unity projects. Follow these rules so that new code reads like the existing code.
using directives → blank line → namespace X { → blank line →
type(s) → blank line → } // namespace X.} // namespace MyEffect..Editor sub-namespace.using directives and aliasesusing ShaderIDs = MyEffect.ShaderPropertyIDs;
using GraphicsFormat = UnityEngine.Experimental.Rendering.GraphicsFormat;
sealed. Use partial to split a large controller across
several focused files (see "Partial split").Create()/OnDisable():
void OnDisable() => OnDestroy();
public override void Create() => _pass = new MyPass { renderPassEvent = _passEvent };
_camelCase with a leading underscore.[field:SerializeField]:
[field:SerializeField, Range(0, 1)]
public float HueShift { get; set; }
[field:SerializeField]
public float Scale { get; set; } = 1.1f;
Assign defaults inline. Add [Range(...)], [ColorUsage(...)] etc. inside the
same attribute list.[SerializeField, HideInInspector] Shader _shader = null;
#region:
// Public properties
// MonoBehaviour implementation
// Private members
When a controller grows, split it by concern into separate files, each declaring
public sealed partial class XController:
XController.cs — MonoBehaviour lifecycle (Update, OnDisable, OnDestroy).XControllerProperties.cs — the serialized [field:SerializeField] properties.XControllerRender.cs / ...Bindings.cs — material/buffer handling, shader IDs....Upgrader.cs — editor-only migration helpers.var for locals when the type is obvious.a, s, c, o,
desc, mat, ctrl, param).if (ctrl == null || !ctrl.enabled || !ctrl.IsReady) return;
(bool init, bool capture) _flags;
(_pageBase, _pageFlip) = (_pageFlip, _pageBase);
Unity.Mathematics (float3x3, float4x4,
math.mul, math.radians) rather than UnityEngine types.Apply this only when writing a custom inspector.
[CustomEditor(typeof(XController))], class sealed, internal by default; add
CanEditMultipleObjects when the inspector supports it.[field:SerializeField] auto-property backing fields by their generated
name: serializedObject.FindProperty("<PropName>k__BackingField").[SerializeField] VisualTreeAsset _uxml; cloned via
_uxml.CloneTree() in CreateInspectorGUI(); wire buttons/visibility there.OnInspectorGUI with serializedObject.Update() … explicit
EditorGUILayout.PropertyField(...) calls … ApplyModifiedProperties(), using
EditorGUILayout.Space() to group and conditional fields to hide irrelevant
options.