docs.unity3d.com
    Show / Hide Table of Contents

    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.

    Inheritance
    Object
    GridBrush
    RandomBrush
    Inherited Members
    UnityEditor.Tilemaps.GridBrush.Init(UnityEngine.Vector3Int)
    UnityEditor.Tilemaps.GridBrush.Init(UnityEngine.Vector3Int, UnityEngine.Vector3Int)
    UnityEditor.Tilemaps.GridBrush.Erase(UnityEngine.GridLayout, UnityEngine.GameObject, UnityEngine.Vector3Int)
    UnityEditor.Tilemaps.GridBrush.BoxFill(UnityEngine.GridLayout, UnityEngine.GameObject, UnityEngine.BoundsInt)
    UnityEditor.Tilemaps.GridBrush.BoxErase(UnityEngine.GridLayout, UnityEngine.GameObject, UnityEngine.BoundsInt)
    UnityEditor.Tilemaps.GridBrush.FloodFill(UnityEngine.GridLayout, UnityEngine.GameObject, UnityEngine.Vector3Int)
    UnityEditor.Tilemaps.GridBrush.Rotate(UnityEngine.GridBrushBase.RotationDirection, UnityEngine.GridLayout.CellLayout)
    UnityEditor.Tilemaps.GridBrush.Flip(UnityEngine.GridBrushBase.FlipAxis, UnityEngine.GridLayout.CellLayout)
    UnityEditor.Tilemaps.GridBrush.MoveStart(UnityEngine.GridLayout, UnityEngine.GameObject, UnityEngine.BoundsInt)
    UnityEditor.Tilemaps.GridBrush.MoveEnd(UnityEngine.GridLayout, UnityEngine.GameObject, UnityEngine.BoundsInt)
    GridBrush.Reset()
    UnityEditor.Tilemaps.GridBrush.UpdateSizeAndPivot(UnityEngine.Vector3Int, UnityEngine.Vector3Int)
    UnityEditor.Tilemaps.GridBrush.SetTile(UnityEngine.Vector3Int, UnityEngine.Tilemaps.TileBase)
    UnityEditor.Tilemaps.GridBrush.SetMatrix(UnityEngine.Vector3Int, UnityEngine.Matrix4x4)
    UnityEditor.Tilemaps.GridBrush.SetColor(UnityEngine.Vector3Int, UnityEngine.Color)
    UnityEditor.Tilemaps.GridBrush.GetCellIndex(UnityEngine.Vector3Int)
    GridBrush.GetCellIndex(Int32, Int32, Int32)
    GridBrush.GetCellIndex(Int32, Int32, Int32, Int32, Int32, Int32)
    GridBrush.GetCellIndexWrapAround(Int32, Int32, Int32)
    GridBrush.GetHashCode()
    GridBrush.size
    GridBrush.pivot
    GridBrush.cells
    GridBrush.cellCount
    UnityEditor.Tilemaps.GridBrush.canChangeZPosition
    Namespace: UnityEditor.Tilemaps
    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
    Boolean

    pickRandomTiles

    A flag to determine if picking will add new RandomTileSets

    Declaration
    public bool pickRandomTiles
    Field Value
    Type Description
    Boolean

    randomTileSets

    An array of RandomTileSets to choose from when randomizing

    Declaration
    public RandomBrush.RandomTileSet[] randomTileSets
    Field Value
    Type Description
    RandomBrush.RandomTileSet[]

    randomTileSetSize

    The size of a RandomTileSet

    Declaration
    public Vector3Int randomTileSetSize
    Field Value
    Type Description
    Vector3Int

    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
    GridLayout grid

    Grid used for layout.

    GameObject brushTarget

    Target of the paint operation. By default the currently selected GameObject.

    Vector3Int position

    The coordinates of the cell to paint data to.

    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
    GridLayout gridLayout

    Grid to pick data from.

    GameObject brushTarget

    Target of the picking operation. By default the currently selected GameObject.

    BoundsInt bounds

    The coordinates of the cells to paint data from.

    Vector3Int pickStart

    Pivot of the picking brush.

    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023