← LeaderboardThe Skill Leaderboard

shader-graph-create-custom-node

Generates custom Shader Graph nodes from HLSL code. Use when the user wants a new Shader Graph node or to make existing HLSL work as a reflected function node.

Published by Unity-Technologies ↗Unity-Technologies/skills

Try your first task

Create a small custom Shader Graph node

Start a fresh conversation.

Use the shader-graph-create-custom-node skill to turn my supplied HLSL function into a custom Shader Graph node. Add the required reflection define, function hints, and support include. Search for an existing custom-node HLSL asset first and show its contents for confirmation before appending; otherwise create a new HLSL asset.

Required inputs

  • A Unity project with com.unity.shadergraph version 17.5.0 or later.
  • The HLSL function to expose and the intended node display name, search category, and search terms.

Previously published starter task based on a pinned source version; check the source and required inputs before running. Task evidence ↗

SKILL.md

name: shader-graph-create-custom-nodedescription: Generates custom Shader Graph nodes from HLSL code. Use when the user wants a new Shader Graph node or to make existing HLSL work as a reflected function node.required_packages:   com.unity.shadergraph: ">=17.5.0"

Generating a custom Shader Graph node

Step 1: Generate an HLSL function definition

  • The function must be preceded by the preprocessor define UNITY_EXPORT_REFLECTION

Step 2: Decorate with Shader Graph hint tags

  • See resources/all_hints.hlsl for all valid hint tags and usage patterns
  • C#-style documentation tags are supported outside of funchints or paramhints blocks
  • Required function hints:
    • sg:ProviderKey
    • sg:SearchCategory
    • sg:SearchTerms
    • sg:DisplayName

Step 3: Write the code to an asset

  • Search the project for a ShaderInclude asset (.hlsl) that already contains custom Shader Graph nodes
  • If a matching asset exists, show the user its current contents and ask for confirmation before appending the new code
  • If no matching asset exists, create a new .hlsl asset
  • Ensure the file begins with #include "ShaderApiReflectionSupport.hlsl"