Prefab Brush
Contributions by: Pepperized, superkerokero, vladderb, RyotaMurohoshi, ManickYoj, Quickz
This Brush instances and places randomly selected Prefabs onto the target location and parents the instanced object to the paint target. Use this Brush as an example to create custom Brushes which can quickly place an assortment of GameObjects onto structured locations.
Properties
Property | Function | |
---|---|---|
Perlin Scale | The factor using the Perlin noise algorithm for the random distribution of Prefabs chosen when painting. | |
Prefabs | Set the number of and selection of Prefabs to paint from. | |
Size | Set the number of Prefabs that the Brush selects from. | |
Element * | Set one of the Prefabs to select from for each entry. The number of Element entries matches the value set in Size. |
Usage
First set the number of Prefabs to select from in the Prefabs property, then add Prefab Assets to the list. Adjust the Perlin Scale property to adjust the distribution of Prefabs painted onto a particular cell.
When painting with the Prefab Brush, the Prefab Brush picks from the available Prefabs based on the Perlin Scale set, and instantiate the Prefabs to the Scene.
Implementation
The Prefab Brush inherits from the Grid Brush and implements the following overrides:
- 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.