Class PrefabRandomBrush
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.
Inherited Members
Namespace: UnityEditor.Tilemaps
Syntax
[CustomGridBrush(false, true, false, "Prefab Random Brush")]
public class PrefabRandomBrush : BasePrefabBrush
Methods
Erase(GridLayout, GameObject, Vector3Int)
If "Erase Any Objects" is true, erases any GameObjects that are in a given position within the selected layers. If "Erase Any Objects" is false, erases only GameObjects that are created from owned Prefab in a given position within the selected layers. The PrefabRandomBrush overrides this to provide Prefab erasing functionality.
Declaration
public override void Erase(GridLayout grid, GameObject brushTarget, Vector3Int position)
Parameters
Type | Name | Description |
---|---|---|
GridLayout | grid | Grid used for layout. |
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 GameObject from containg Prefabs with randomly into a given position within the selected layers. The PrefabRandomBrush overrides this to provide Prefab 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. |