Unity Mesh Tilesets is a Unity editor extension that can be used to automatically place objects along ProBuilder meshes based on rules from a tileset. The tool is heavily inspired by the tile mesh feature of Valve's Source Engine 2 that was used for many different props in Half Life Alyx.
Mesh Tilesets requires ProBuilder. ProBuilder will be added automatically to your project if it has not been installed yet. It is also highly recommended to install ProGrids as well (note that ProGrids is still in preview so you have to enable preview packages in the package manager).
Make sure you have the OpenUPM CLI installed. From the root of your project run:
openupm add com.freshlybrewedcode.unity-mesh-tilesets
Open the Unity package manager, click on the plus icon in the top left corner and select "Add package from git URL". Paste the following URL into the text field:
https://github.com/FreshlyBrewedCode/unity-mesh-tilesets.git#upm
Note: You will not be able to select a specific version or update the package using this method. If you want to update to the latest version you have to remove the package and add it again using the url above.
Download or clone the repository and add the Assets/Mesh Tilesets
folder into the Assets
folder of your Unity project.
Check out the getting started section in the documentation.
The tool works using primitive meshes that you create and modify directly inside of Unity using ProBuilder. You place the TilesetRenderer
component on your tile mesh GameObject and it will find rectangular quads ("tile instances") in the mesh. Each tile instance has an orientation (top, bottom, left, right, normal), a size (width, height) and knows about other adjacent tiles.
You assign a tileset to the TilesetRenderer
that can contain any number of tiles. Each tile is basically a prefab that contains information about the size of the tile (width, height) and "rules" about if there can or should be any tiles adjacent to the left/right/top/bottom of the tile.
For each tile instance in the mesh the TilesetRenderer
tries to find a tile from the assigned tileset that "fits" (by comparing size and adjacency).
Check out the documentation for more info.
Here are some example use cases for the tool. I am sure there are many more creative ways to use this tool. If you have a cool example feel free leave a pull request and add it to the list.
If you like this tool and you would like to support me, feel free to buy me coffee:
Thank you :)
Pull request welcome.
TODO
MIT
The tool can be used freely in any project of any scale. Please don't redistribute the tool through the Unity Assetstore or a similar marketplace.