Files
Test/Library/PackageCache/com.unity.shadergraph@8b7e693cdbfe/Documentation~/Sub-graphs.md
T
2026-11-01 23:39:55 +02:00

1.7 KiB

Sub Graphs

A Sub Graph is a type of shader graph that you include in other shader graphs. Use a Sub Graph to perform the same operations multiple times within a single shader graph, or across multiple shader graphs. It's similar to a reusable function in programming.

Topic Description
Introduction to Sub Graphs Learn about how a Sub Graph differs from a regular shader graph, and refer to example Sub Graphs.
Create a Sub Graph Create a Sub Graph from existing nodes, or create an empty Sub Graph.
Add a Sub Graph to a shader graph Add a Sub Graph node to a shader graph.
Add inputs and outputs to a Sub Graph To pass data in and out of a Sub Graph, create input and output ports.
Change how Sub Graph inputs appear on a node Display a float input as a slider or dropdown, or set an input value on the node instead of a port.
Set default inputs for a Sub Graph Add default values for the inputs of a Sub Graph.
Change the behavior of a Sub Graph with a dropdown Add a Dropdown node to change the behavior of a Sub Graph using a dropdown menu.
Expose a Sub Graph property in the Inspector window Set a property or keyword as belonging to the main shader instead of a Sub Graph. This process is known as promoting the property, or creating a nested property.
Sub Graph asset Learn about the Sub Graph asset.

Additional resources