Instant Pipes

An editor tool for procedurally generating pipes by just dragging the cursor from start to end—the pipe will find the path in a customizable way.

github

A gif showing a bunch pipes appearing instantly following the cursor drag.

Compatibility

Unity 2019.4 or higher.

Installation

Add the package to your project via the Package Manager using the Git URL https://github.com/leth4/InstantPipes.git. You can also clone the repository and point the Package Manager to your local copy.

Usage

Starting out

  1. Create an empty GameObject and set its world position to zero.
  2. Add a Pipe Generator component.
  3. Select a material for the Material property.

If you're facing problems, visit the troubleshooting section.

Ctrl+Z works with all actions. When you're commited to the pipes, you can just remove the component, the mesh will stay.

Pipes Settings

Using pathfinding

In the component inspector, select the Create tab. Now in the scene view start dragging your cursor where you want the pipe to start, end let go where you want it to end; a pipe will appear.

The tool uses A* pathfinding without a predefined grid—by raycasting from a point to the next points. Pipes can only detect colliders as obstacles.

Property Explanation
Preview Path Will preview how the pipe will look like while dragging. Can be slow with complex pipes!
Amount How many pipes will be created at once; each one will have an individual path.
Max Iterations How many points will the algorithm check before giving up.
Grid Y Angle Rotates the Y axis of the pathfinding grid that every pipe has to follow.
Grid Size The distance between searched points; making it too small can produce bad results.
Height How high the first and the last segment of a pipe will be. This value can't be smaller than grid size.
Chaos Adds randomness to the pathfinding, making paths twisted and chaotic.
Straight Priority Makes the algorithm prefer straight paths over turns.
Near Obstacle Priority Makes the pipes stay close to obstacles.

An image showing differences between pipe settings, showing a normal pipe, a more straight pipe, a pipe sticking to surfaces and a chatotic pipe.

Manual Editing

In the component inspector, select the Edit tab. Select one of the points in the scene view by clicking on it, and then you can:

Hold Shift to select multiple points. Press A to select every point of the selected pipe.

Every pipe is a separate submesh, so you can assign separate materials by dragging them into the scene view.

Troubleshooting

Getting an error when trying to build

Pipes appear squashed

Dragging my cursor doesn't do anything

Pipes can't find a way