Random Brush | 2D Tilemap Extras | 1.5.0-preview
docs.unity3d.com
    Show / Hide Table of Contents

    Random Brush

    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.

    Properties

    Property Function
    Pick Random Tiles When picking, pick the Tiles from the selection as a random Tile set.
    Add To Random Tiles When picking, add picked Tile sets to existing Tile sets instead of replacing existing Tile sets.
    Tile Set Size The size of Tile sets.
    Number of Tiles The number of Tile sets.
    Tile Set A Tile set to randomize from
    Tiles The Tiles in the Tile Set.

    Usage

    To create Tile sets, you will need to define the size of the Tile set you want to paint with using the Tile Set Size property. After that, you can add them manually with the Brush Editor or select them from an existing Tile Palette.

    To select them from an existing Tile Palette, enable the Pick Random Tiles property and select the Tile Sets using the Pick Tool. This will create a Tile set in the Brush Editor or sets if the Picking size is larger than the Tile Set size. Enable the Add To Random Tiles property to add on the new Tile set/s to existing Tile sets.

    Brush Editor with Random Brush

    When painting with the Random Brush, the Random Brush will randomly pick from the available Tile sets and fill it

    Scene View with Random Brush

    Implementation

    The RandomBrush inherits from the GridBrush. It overrides the Paint method to paint random selections of Tiles from chosen Tile sets. It overrides the Pick method to be able to pick selections of Tiles for the random Tile sets.

    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