Shader Graph Create Custom Node

by unity-technologiescb1dccb8f5adNo license1K starsListed Oct 8, 2026Updated Oct 8, 2026Repository updated today

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.

Instructions onlySoftware Development
AI-generated overview

Generates custom Unity Shader Graph nodes from HLSL code with reflection hints and writes them to an .hlsl asset.

What it does
This skill guides the creation of custom Shader Graph nodes from HLSL function definitions. It covers adding the UNITY_EXPORT_REFLECTION preprocessor define, decorating functions with required Shader Graph hint tags such as sg:ProviderKey and sg:DisplayName, and writing the resulting code into a ShaderInclude (.hlsl) asset. It also checks for an existing asset containing custom nodes and asks for confirmation before appending.
When to use it
Use this when a user wants a new Shader Graph node or wants existing HLSL code to work as a reflected function node. It is intended for Unity projects using the Shader Graph package.
Requirements
Requires the Unity Shader Graph package (com.unity.shadergraph >= 17.5.0) and a Unity project with ShaderInclude assets. It ships no scripts; it relies on the bundled resources/all_hints.hlsl reference file.

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"

Source and attribution

Source:unity-technologies/skillsinskills/shader-graph-create-custom-nodeat commitcb1dccb

License: No license

Content belongs to its original authors. SourceWeft indexes it from a public repository.

Report or request removal