unity-shadergraph
Shader Graph asset creation, structure inspection, constrained blackboard editing, and constrained node-subset editing for `.shadergraph` / `.shadersubgraph`. Use when users want to create graphs, inspect real node/slot structure, edit properties or keywords, or perform safe low-level node operations. Triggers: Shader Graph, shadergraph, sub graph, blackboard property, shader keyword, node editing, slot connect, 着色图, 子图, ShaderGraph 属性, ShaderGraph 节点, ShaderGraph 连线.
- License 许可
- MIT
- 最近更新
- 2026-07-25
- Stars
- ★ 8
- Forks
- 0
01 前言 Front Matter
- name
- unity-shadergraph
- metadata
- { "tier": 2, "source": "https://github.com/Besty0728/Unity-Skills", "version": "1.9.2" }
- use-when
- Load when the task requires: Shader Graph asset creation, structure inspection, constrained blackboard editing, and constrained node-subset editing for `.shadergraph` / `.shadersubgraph`. Use when users want to create graphs, inspect real node/slot structure, edit properties or keywords, or perform safe low-level node operations. Unity Editor must be running with the unity-skills REST server reachable at http://localhost:8090.
- platforms
- [ "unity-editor", "claude-code" ]
- description
- Shader Graph asset creation, structure inspection, constrained blackboard editing, and constrained node-subset editing for `.shadergraph` / `.shadersubgraph`. Use when users want to create graphs, inspect real node/slot structure, edit properties or keywords, or perform safe low-level node operations. Triggers: Shader Graph, shadergraph, sub graph, blackboard property, shader keyword, node editing, slot connect, 着色图, 子图, ShaderGraph 属性, ShaderGraph 节点, ShaderGraph 连线.
- do-not-use-when
- Do not load when Unity Editor is not running locally. Do not load when unity-skills REST server is unreachable at http://localhost:8090.
- task-categories
- [ "shadergraph", "rendering", "editor-automation" ]
03 SKILL.md 正文
ShaderGraph Skills
Shader Graph asset workflows for Unity 2022.3+ with source-backed template handling, MultiJson inspection, and constrained internal-editor reflection writes.
Operating Mode
- Query skills (
shadergraph_list_templates,shadergraph_list_assets,shadergraph_get_info,shadergraph_get_structure,shadergraph_list_supported_nodes,shadergraph_list_properties,shadergraph_list_keywords) areSkillMode.SemiAuto— they run in all three modes without grant. - All other mutators (create graph / subgraph, add/move/connect/disconnect node, set node defaults/settings, add/update property/keyword, reimport) are
SkillMode.FullAuto— under Approval they need user grant (grant triggers one server-side execute returning the result); under Auto / Bypass they execute directly. shadergraph_remove_node,shadergraph_remove_property,shadergraph_remove_keywordcarrySkillOperation.Deleteand are auto-forbidden in Approval / Auto modes (NeverInSemi). Only Bypass or the user-managed Allowlist can run them.
Reflection Fragility
This module reaches into UnityEditor.ShaderGraph and UnityEditor.ShaderGraph.Internal via reflection (see ShaderGraphReflectionHelper.cs and ShaderGraphNodeRegistry.cs). The supported node whitelist, slot layout, and settings keys are version-pinned to com.unity.shadergraph 14.0.x (Unity 2022.3) with limited Unity 6 coverage. Treat the following as a hard contract:
- Never assume an internal type, field, or slot id exists from memory — always cross-check with
shadergraph_list_supported_nodesandshadergraph_get_structurefirst. - If a Shader Graph package update changes internal types or
MultiJsonschema, mutators may fail or silently no-op until the registry is updated. - If a skill returns an error mentioning a reflection / type lookup failure, do not retry with different argument shapes — report the version mismatch and stop.
Guardrails
Routing:
- HLSL text shaders: use
shader_* - Shader Graph / Sub Graph assets: use this module
- Source-anchored design guidance before proposing graph architecture: load shadergraph-design
Runtime-first rules:
- Always call
shadergraph_get_structurebefore any node-level edit; treat returnednodeIdandslotIdas the only valid identifiers - Never invent slot names, node ids, or template availability from memory
shadergraph_set_node_defaultsonly applies to unconnected input slots; if the slot is connected, disconnect firstshadergraph_set_node_settingsonly writes the whitelist exposed byshadergraph_list_supported_nodesPropertyNodeonly binds existing blackboard properties; create the property first withshadergraph_add_property- SubGraph editing is limited to ordinary nodes; this module does not edit
SubGraphOutputNodestructure
Validated behavior:
- Unity 2022.3 +
com.unity.shadergraph@14.0.12does not shipGraphTemplates/;shadergraph_create_graphfalls back to blank graph creation - Unity 6 ShaderGraph packages may provide actual template directories; template listing and template-copy creation remain available there
- The supported node subset is runtime-filtered. The shared overlap is 28 nodes in live validation, while
AppendVectorNodeis currently Unity 6 only
Skills
shadergraph_list_templates
List Shader Graph templates shipped by the installed package.
shadergraph_create_graph
Create a Shader Graph asset from a package template or blank fallback.
shadergraph_create_subgraph
Create a blank Shader Sub Graph asset with a configured output slot.
shadergraph_list_assets
List Shader Graph and Sub Graph assets in the project.
shadergraph_get_info
Get a high-level summary of a Shader Graph or Sub Graph asset.
shadergraph_get_structure
Inspect the live graph structure. Returns real nodeId, position, slots, edges, properties, and keywords.
shadergraph_list_supported_nodes
List the constrained node whitelist, supported versions, slots, and editable settings.
shadergraph_add_node
Add a supported node by nodeType with optional initial settings and position.
shadergraph_remove_node
Remove a node by serialized nodeId; related edges are removed together.
shadergraph_move_node
Move a node by serialized nodeId.
shadergraph_connect_nodes
Connect a specific output slot to a specific input slot using nodeId + slotId.
shadergraph_disconnect_nodes
Disconnect one exact edge using the same four-tuple.
shadergraph_set_node_defaults
Set the default value of an unconnected input slot.
shadergraph_set_node_settings
Write whitelisted node settings only.
shadergraph_list_properties
List graph blackboard properties.
shadergraph_add_property
Add a constrained blackboard property.
shadergraph_update_property
Update a constrained blackboard property.
shadergraph_remove_property
Remove a graph property.
shadergraph_list_keywords
List graph blackboard keywords.
shadergraph_add_keyword
Add a graph keyword.
shadergraph_update_keyword
Update a graph keyword.
shadergraph_remove_keyword
Remove a graph keyword.
shadergraph_reimport
Force reimport of a Shader Graph asset after external edits.
Workflow
- Create or locate the target graph.
- Read
shadergraph_get_structure. - If needed, create blackboard properties or keywords first.
- Call
shadergraph_list_supported_nodesto confirm node type, settings whitelist, and slot layout. - Add/move nodes, then connect/disconnect using the live
nodeId/slotIdvalues. - Re-read
shadergraph_get_structureafter each significant edit if the next step depends on topology.
Exact Signatures
Exact names, parameters, defaults, and returns are defined by GET /skills/schema or unity_skills.get_skill_schema(), not by this file.
04 同仓库更多 Skills
dots-update-groups
How to choose the right ECS system group and ordering so per-frame and per-fixed-step work is deterministic and never races its own readers. Covers InitializationSystemGroup / SimulationSystemGroup / PresentationSystemGroup / FixedStepSimulationSystemGroup / VariableRateSimulationSystemGroup, UpdateBefore / UpdateAfter peer ordering, OrderFirst / OrderLast group-boundary placement, RateManager, and the cross-group ordering trap. Use when adding an ISystem, fixing "value visible one frame late" bugs, or coupling simulation to a fixed timestep.
dots-transform-patterns
The Entities 1.x transform model — LocalTransform (writable input) vs LocalToWorld (system-owned matrix), Parent/Child hierarchy, reparenting cost, uniform vs non-uniform scale (PostTransformMatrix), and when to opt out with custom transform systems. Use when designing parent/child hierarchies, runtime reparenting (mount/dismount/socket), or choosing transform components at the Baker boundary.
dots-singleton-patterns
Model cross-system shared configuration and game state as a single-entity component with a strict single-writer contract. Covers RequireForUpdate gating, SystemAPI.GetSingleton / GetSingletonRW / HasSingleton / TryGetSingleton, bake-time vs runtime-created vs ECB-system singletons, the "exactly one entity" runtime invariant, and the single-writer rule. Use when designing frame-stable global config, shared mutable state, or any component intended to exist on exactly one entity.
dots-hybrid-bridge
The one-way bridge between DOTS-owned runtime state and Unity-owned presentation. Covers UnityObjectRef for managed asset refs in components, the DOTS-writes / Unity-reads ownership rule, when to use managed IComponentData vs UnityObjectRef vs CompanionComponent, baker-bridge vs runtime-bridge, and SubScene boundary rules. Use when an entity must reference Unity assets (Mesh, Material, AudioClip, ScriptableObject), a MonoBehaviour view must read entity state, or input/UI must trigger ECS work.
dots-event-driven-ecs
Model one-frame events and external requests in ECS without dual ownership, polling, or persistent state leaks. Covers request-tag pattern with ECB, enableable command components (no structural change), event buffers (IBufferElementData), explicit consumer ownership, one-frame latency rules, and the banned C# event / UnityEvent / static bus anti-patterns. Use when input/UI/network must trigger ECS work, when a one-frame signal fans out to N consumers (damage, hit, collision), or when state changes must be processed exactly once.
valid_skill
A complete, well-formed test fixture skill for SkillHub validation testing. Covers basic task routing and code review for Unity projects.