Tutorial Core workflow

Getting Started with Attributes and Subgraphs

Build a reusable point-cluster graph, then call it from a parent graph that places differently sized clusters along a spline. Along the way, you will use the ElementSet preview, constant-or-attribute bindings, pinned previews, and required subgraph attributes.

What you will build

The finished setup uses two graphs:

  1. Tour, a reusable subgraph that expands every incoming element into a sphere-shaped point cluster. Its radius comes from an attribute, so each input row can produce a different result.
  2. Main, a parent graph that distributes points along a spline, writes a random radius value to each row, and passes that ElementSet through Tour.

The key mental model is a spreadsheet: an ElementSet is the table, each element is a row, and attributes such as position, localIndex, and radius are columns. Graph settings and parameters are global controls; attributes can vary from row to row.

You need OctoShaper installed and a simple cube prefab if you want to preview realized objects. Open Tools > OctoShaper > Getting Started for links to the documentation, support, settings, and demo importer. See Installation and Node Graph Basics if you have not created a graph before.

The video is a companion to the complete workflow below.

1. Create the point-cluster graph

Create a Procedural Graph asset and name it Tour. Open it, then connect the graph's main input through your nodes to its main output. A graph needs this connected path before it can return a useful ElementSet.

Add position to the main input's required attributes. Select the input node and inspect its ElementSet preview: the editor represents the data as rows and named attribute columns.

Add Distribute Points On Line, followed by Sample Points In Sphere Per Element. The line node provides useful columns including position, localIndex, and sourceRowIndex; the sphere node expands every incoming row into a cluster.

Video reference: reading the ElementSet preview at 1:00

2. Drive a node input from an attribute

Start with a fixed sphere radius and sample count so you can see the basic shape. Then change the sphere node's Count binding from a constant to the localIndex attribute created by Distribute Points On Line.

Each source row now supplies its own count. With line indices 0, 1, 2, and 3, later clusters contain progressively more points. This constant-or-attribute switch is fundamental: use a constant when every row should receive the same value, and an attribute when the value already lives in the ElementSet.

Video reference: switching Count to Local Index at 4:05

3. Preview the right stage of the graph

Add Spawn Prefab, assign a cube prefab, and connect it toward the main output. The graph can now show actual cube instances as well as its diagnostic point markers.

Use the two pin modes deliberately:

  • Preview keeps a node's realized result visible, including spawned prefabs.
  • Gizmos keeps the read-only positions and other diagnostic markers visible.

Pin the stage you want to compare before selecting another node. If a graph becomes expensive to update while you drag a value, disable real-time preview so it recomputes after the edit instead. Context Manipulation explains the difference between previews, gizmos, and editable Scene view handles in more detail.

Video reference: pinning graph stages and comparing preview modes at 6:30

4. Make radius part of the subgraph contract

Return to Tour's main input and add a required float attribute named radius. On Sample Points In Sphere Per Element, change Radius from a constant to that attribute.

Tour now has an explicit contract: every incoming row must contain position and radius. The graph keeps working on the same ElementSet structure, expanding its rows and carrying their attributes forward. Save the graph so it becomes available as a node in another graph.

This distinction keeps tools reusable: use graph parameters for one global control, and required input attributes for values that must vary for every subgraph instance.

Video reference: exposing Radius as a required attribute at 8:44

5. Instance varied clusters along a spline

Create a second graph named Main and add a spline parameter. Use Unity's OctoShaper spline tool to place at least two control points, then add Distribute Points On Spline By Distance to generate rows along the path.

Add the Tour subgraph after the spline distribution. If the connection is rejected, inspect Tour's input requirements: the parent data is missing radius. Insert Set Random Float Attribute, name the attribute radius, and use 1 and 5 as useful starting values for its minimum and maximum. Connect the resulting ElementSet to Tour, then connect Tour to the main output.

Every spline sample now carries its own deterministic radius into the subgraph, producing a chain of differently sized point clusters. Change the random seed to explore another variation without rebuilding the graph.

Video reference: varying subgraph radius per spline point at 12:51

Troubleshooting

  • The subgraph will not connect: match the attribute name and type exactly. Tour requires a float attribute called radius before it runs.
  • Every cluster has the same size: confirm that Tour's Radius binding is set to the attribute, not a constant.
  • You see points but no cubes: pin Preview on the Spawn Prefab stage and make sure a prefab is assigned. Gizmos alone show diagnostic markers.
  • Editing feels slow: reduce point counts while authoring or turn off real-time preview until the graph is lighter.

Use Working with Splines to refine the path, or browse the Node Catalog for the exact inputs and attribute effects of every node used here.