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

    Class PrefabBrush

    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.

    Inheritance
    Object
    GridBrush
    PrefabBrush
    Inherited Members
    UnityEditor.Tilemaps.GridBrush.Init(UnityEngine.Vector3Int)
    UnityEditor.Tilemaps.GridBrush.Init(UnityEngine.Vector3Int, 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.Pick(UnityEngine.GridLayout, UnityEngine.GameObject, UnityEngine.BoundsInt, UnityEngine.Vector3Int)
    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
    [CreateAssetMenu(fileName = "New Prefab Brush", menuName = "Brushes/Prefab Brush")]
    [CustomGridBrush(false, true, false, "Prefab Brush")]
    public class PrefabBrush : GridBrush

    Fields

    m_Anchor

    Anchor Point of the Instantiated Prefab in the cell when painting

    Declaration
    public Vector3 m_Anchor
    Field Value
    Type Description
    Vector3

    m_PerlinScale

    Factor for distribution of choice of Prefabs to paint

    Declaration
    public float m_PerlinScale
    Field Value
    Type Description
    Single

    m_Prefabs

    The selection of Prefabs to paint from

    Declaration
    public GameObject[] m_Prefabs
    Field Value
    Type Description
    GameObject[]

    Methods

    Erase(GridLayout, GameObject, Vector3Int)

    Erases Prefabs in a given position within the selected layers. The PrefabBrush overrides this to provide Prefab erasing functionality.

    Declaration
    public override void Erase(GridLayout grid, GameObject brushTarget, Vector3Int position)
    Parameters
    Type Name Description
    GridLayout grid
    GameObject brushTarget

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

    Vector3Int position

    The coordinates of the cell to erase data from.

    Paint(GridLayout, GameObject, Vector3Int)

    Paints Prefabs into a given position within the selected layers. The PrefabBrush overrides this to provide Prefab painting functionality.

    Declaration
    public override void Paint(GridLayout grid, GameObject brushTarget, Vector3Int position)
    Parameters
    Type Name Description
    GridLayout grid
    GameObject brushTarget

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

    Vector3Int position

    The coordinates of the cell to paint data to.

    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