Class RandomBrush
This Brush helps to place random Tiles onto a Tilemap. Use this as an example to create brushes which store specific data per brush and to make brushes which randomize behaviour.
Inherited Members
Namespace: UnityEditor .Tilemaps
Assembly: Unity.2D.Tilemap.Extras.Editor.dll
Syntax
[HelpURL("https://docs.unity3d.com/Packages/com.unity.2d.tilemap.extras@latest/index.html?subfolder=/manual/RandomBrush.html")]
[CustomGridBrush(false, false, false, "Random Brush")]
public class RandomBrush : GridBrush
Fields
addToRandomTiles
A flag to determine if picking will add to existing RandomTileSets
Declaration
public bool addToRandomTiles
Field Value
Type | Description |
---|---|
bool |
pickRandomTiles
A flag to determine if picking will add new RandomTileSets
Declaration
public bool pickRandomTiles
Field Value
Type | Description |
---|---|
bool |
randomTileSetSize
The size of a RandomTileSet
Declaration
public Vector3Int randomTileSetSize
Field Value
Type | Description |
---|---|
Vector3Int |
randomTileSets
An array of RandomTileSets to choose from when randomizing
Declaration
public RandomBrush.RandomTileSet[] randomTileSets
Field Value
Type | Description |
---|---|
Random |
Methods
Paint(GridLayout, GameObject, Vector3Int)
Paints RandomTileSets into a given position within the selected layers. The RandomBrush overrides this to provide randomized painting functionality.
Declaration
public override void Paint(GridLayout grid, GameObject brushTarget, Vector3Int position)
Parameters
Type | Name | Description |
---|---|---|
Grid |
grid | Grid used for layout. |
Game |
brushTarget | Target of the paint operation. By default the currently selected GameObject. |
Vector3Int | position | The coordinates of the cell to paint data to. |
Overrides
Pick(GridLayout, GameObject, BoundsInt, Vector3Int)
Picks RandomTileSets given the coordinates of the cells. The RandomBrush overrides this to provide picking functionality for RandomTileSets.
Declaration
public override void Pick(GridLayout gridLayout, GameObject brushTarget, BoundsInt bounds, Vector3Int pickStart)
Parameters
Type | Name | Description |
---|---|---|
Grid |
gridLayout | Grid to pick data from. |
Game |
brushTarget | Target of the picking operation. By default the currently selected GameObject. |
Bounds |
bounds | The coordinates of the cells to paint data from. |
Vector3Int | pickStart | Pivot of the picking brush. |