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

    Prefab Brush

    Contributions by: Pepperized, superkerokero

    This Brush instances and places a randomly selected Prefabs onto the targeted location and parents the instanced object to the paint target. Use this as an example to quickly place an assorted type of GameObjects onto structured locations.

    Properties

    Property Function
    Perlin Scale Factor for distribution of choice of Prefabs to paint
    Prefabs The selection of Prefabs to paint from

    Usage

    To add Prefabs to paint, change the number of Prefabs in the Prefabs property and add Prefab assets to the them.

    To change the random distribution of Prefabs painted, change the Perlin Scale property. This will change the distribution of Prefabs painted on a particular cell.

    Brush Editor with Prefab Brush

    When painting with the Prefab Brush, the Prefab Brush will pick from the available Prefab selection based on the Perlin Scale and instantiate it to the Scene.

    Scene View with Prefab Brush

    Implementation

    The PrefabBrush inherits from the GridBrush. It overrides the Paint method to paint a Prefab from the Prefab selection. It overrides the Erase method to be able to erase the instantiated Prefabs or other GameObjects from the Scene.

    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