There are already many prefab painters available for Unity, this is yet another one. In case you have use for this one, feel free.
It's Open Source, so also feel free to fork, modify and add more features to it.
Here's a quick demo use case video to get you started:
Unity 2018.3+
Installation
-
create a new Unity project
-
add the Yapp folder of this repository to your project or install via Package Manager and this git url:
https://github.com/Roland09/PrefabPainter.git?path=/Assets/Yapp
-
in Hierarchy view open the context menu and press Yapp -> Create PrefabPainter
The created prefab painter looks like this initially in the inspector:
There are 2 things that are now required:
-
a container to put your prefabs in. You can use any gameobject for that. For convenience when you hit the New button, a container is generated automatically as child object of your prefab painter gameobject. But you can use whatever you prefer, it doesn't necessarily have to be a child. Just drag your container gameobject into the container slot.
-
prefabs which should be instantiated in the scene by this prefab painter and put into the specified container. The container can be cleared, i. e. the container children deleted, by using the Clear button.
Now you can already start painting. Please read the scene view instructions about how to use the current brush, e. g. shift + mouse drag is painting with the brush.
When I started Unity I thought this might be a good idea to learn coding. Creating a prefab painter is something rather trivial. All you need to do is analyze an area around the mouse cursor and instantiate a prefab there.
However as usual one thing leads to the other and it turned out that there's always something that one wants more. The existing prefab painters - free and commercial - didn't meet my requirements. So I created my own.
A big shoutout to the awesome people of the Unity Community who provided tutorials which I used for the more advanced features. Please see the credits section below.
Operates on gameobjects which are considered containers (or folders) for grouping and contain the actual prefab instances
- Brush
- Spline
- Size
- Rotation
- Align to Terrain
- Allow Overlap
- Slope Dependency
- Distribution Mode
- Center
- Poisson
- Fall off (work in progress)
- Fall off 2d (work in progress)
- Curve Resolution: sharpness, from sharp corners to round curves
- Loop: connect start with end point
- Separation
- Fixed distance
- Prefab Bounds determine distance
- Multiple Lanes along a single Spline
- Lane Distance
- Rotation
- Use the Prefab rotation
- Rotate along the Spline (e. g. like a fence)
- Attach Mode
- Bounds: attach new Spline points at the start or end
- Between: attach new Spline points anywhere on the curve
- Snap: snap spline points at terrain height
- Active: enable/disable the use of this prefab
- Probability: the probability that this prefab will be instantiated
- Change Scale: vary the scale
- Position Offset: offset this prefab by the specified x/y/z coordinates
- Rotation Offset: rotate this prefab by the specified x/y/z angles
- Random Rotation: apply random rotation when this prefab is instantiated
Batch operations are performed on the children of the selected container.
- apply physics (e. g. gravity, forces, etc)
- copy/paste transforms
Please note that this is still beta and work in progress, so features may change. Also the UI might change. Currently I used standard Unity UI setup, it was rather trivial and straightforward to do so.
- Vegetation Studio
- Vegetation Studio Pro
This option allows you to paint into the persistent storage of Vegetation Studio and Vegetation Studio Pro.
- consider prefab dimensions during distribution, align them next to each other
- random distance during distribution
- limit random scale in specific directions
- limit rotation
- undo operations
- prefab thumbnail overview with filter by selecting a prefab thumbnail (or multiple ones)
- ...
-
Sebastian Lague
Physics Simulation https://www.youtube.com/watch?v=SnhfcdtGM2E
-
Kyle Halladay
Spline http://kylehalladay.com/blog/tutorial/2014/03/30/Placing-Objects-On-A-Spline.html
-
Fernando Zapata
Interpolate.cs http://wiki.unity3d.com/index.php?title=Interpolate#Interpolate.cs
-
Unity
Getting the SerializedProperty from an object instead of a string. See example: https://github.com/Unity-Technologies/PostProcessing/blob/v2/PostProcessing/Editor/PostProcessVolumeEditor.cs
-
Gregory Schlomoff
Poisson Disc Sampling in Unity http://gregschlom.com/devlog/2014/06/29/Poisson-disc-sampling-Unity.html