Change how Sub Graph inputs appear on a node
Choose how each Sub Graph input appears on the sub graph node, and which values it accepts.
By default, each input you add to a Sub Graph appears as a port on the Sub Graph node in the parent shader graph. To make a Sub Graph easier to reuse, you can change how an input displays, or remove the port so that the input accepts a constant value only.
These options apply inside a Sub Graph only. To control an input from the Inspector window of a material instead, refer to Expose a Sub Graph property in the Inspector window.
Display a float input as a slider or dropdown
Use the Mode setting to select how a Float property displays on the Sub Graph node. For example, set Mode to Enum to display a list of named options instead of a number.
To display a float input as a slider or dropdown, follow these steps:
- Open the Sub Graph asset.
- In the Blackboard, select the Float property.
- In the Graph Inspector window, select the Node Settings tab.
- Set Mode to Default, Slider, Integer, or Enum.
- Set the additional settings that appear for the mode you selected.
- Save the sub graph.
When you add the Sub Graph to a shader graph, the Sub Graph node displays a box, a slider, or a dropdown next to the input port, to match the mode you selected. If you remove the port for the input, the node displays it in the body instead.
For a description of each mode and the settings it requires, refer to Property Types.
Set an input value on the node instead of a port
Use Disable connector to remove the input port for a property. The input then appears in the body of the Sub Graph node, where you set its value directly.
You can enable Disable connector for Boolean, Color, Float, and Gradient properties. It's not available if you enable Promote to final Shader, because a promoted property doesn't appear on the Sub Graph node.
To remove the port for an input, follow these steps:
- Open the Sub Graph asset.
- In the Blackboard, select the property.
- In the Graph Inspector window, select the Node Settings tab.
- Enable Disable connector.
- Save the Sub Graph.
When you add the Sub Graph to a shader graph, the input no longer has a port on the Sub Graph node. Instead, the node displays the input in its body, labeled with the name of the property.
Important
If a parent shader graph already connects a node to this input, enabling Disable connector removes that connection. Check every shader graph that uses the Sub Graph after you enable this option.