Singularity/Library/PackageCache/com.unity.2d.tilemap.extras.../Documentation~/LineBrush.md
2024-05-06 11:45:45 -07:00

1.6 KiB

Line Brush

Contribution by : CraigGraff

This Brush draws a line of Tiles onto a Tilemap. With this Brush selected, click once to set the starting point of the line and click again at another position to set the ending point of the line. This Brush then draws a line of Tiles between the two points.

Use this as an example to create custom Brush behavior to make painting more efficient.

Properties

Property Function
Line Start Active Indicates whether the Line Brush has started drawing a line.
Fill Gaps Ensures that there are orthogonal connections between all Tiles that connect the start and end of the line.
Line Start The current starting point of the line.

Usage

Select the Line Brush, then click once on a cell of the Tilemap to set the starting point of the line, then click on a second cell to set the ending point of the line. The Brush then draws the line of Tiles between the two set points. When the Line Brush is active, a blue outline will indicate the starting point of the line.

Scene View with Line Brush

To have Tiles which are orthogonally connected from start to end, enable the Fill Gaps property in the Brush Editor.

Scene View with Line Brush with Fill Gaps

Implementation

The Line Brush inherits from the Grid Brush and overrides the Paint method to implement the line painting functionality.