Taking a break from the normal web dev stuff to share one of my passion projects: game development! If you’ve used the Unity auto-tiler, you know about rule tiles. Manually assigning sprites to each tile in a Unity rule tile can be time-consuming and tedious. This repetitive process significantly slowed down our workflow.

That’s why I’m excited to share my new tool with you: the Auto Rule Tile Generator. The Auto Rule Tile Generator is a tool for Unity designed to streamline the creation of rule tiles based on a predefined template and multiple tilemaps. This tool significantly reduces the time and effort required to manually assign sprites, enabling developers to create visually diverse tilemaps quickly and efficiently.

Understanding Unity Rule Tiles

Before diving into the Auto Rule Tile Generator, let’s take a quick moment to understand what a Unity rule tile actually is. A rule tile defines how a tile connects to its surrounding tiles based on their properties. This allows you to essentially “paint” your levels rather than placing your tiles one by one.

You can create really intricate and interesting patterns with your tilemaps, but it also means a significant amount of manual sprite assignment. That is where the Auto Rule Tile Generator comes in.

Getting Started with Auto Rule Tile Generator

To get up and running, you’ll need to be using Unity version 2021.1 or higher. Once that’s confirmed, you have two options for installing the Auto Rule Tile Generator:

  • Using Git URL: This method is generally the quickest for most users. Simply open your Unity project, navigate to Window > Package Manager, and click the “+” button in the top left corner. Select “Add package from git URL…” and paste the following link: https://github.com/MitchellOpitz/Automatic-Rule-Tile-Generator.git. Click “Add,” and you’re ready to go.
  • Using Local Path (for Development): You’ll need to clone the repository from GitHub using the command line or download the zip file from the repo above. Once you have the code locally, open your Unity project and navigate to Window > Package Manager. Click the “+” button again, but this time select “Add package from disk…”. Point it to the directory containing the package.json file.

Using Auto Rule Tile Generator: A Step-by-Step Guide

Let’s get to the fun part: actually using the tool. Here’s a breakdown of the process:

1.) Create an Auto Rule Tile Asset: Simply right-click anywhere in your Project window and select Create > BF Tools > Auto Rule Tile.

2.) Configure the Auto Rule Tile Generator: After creating your new Auto Rule Tile object, you’ll need to configure it within the Inspector window. Here’s what you’ll find:

  • Tilemaps: This section is where you assign the tilemap images that will be used to construct your rule tile. These tilemaps must follow the layout of the rule tile for the tool to function correctly. You can even use multiple tilemaps for additional visual variety (we’ll explore that in a moment).
  • Rule Tile Template (Optional): This section is geared towards more experienced users. If you’ve created your own custom rule tile template, you can assign it here. Otherwise, the default template provided with the tool will work just fine.
  • I’ve provided a default template for both the tilemap and the rule tile to get you started.

3.) Generate Rule Tiles: Once you’ve assigned your tilemaps (and your custom rule tile template, if applicable), simply click the “Generate Rule Tile” button in the Inspector window. It’ll perform a quick check to ensure everything is set up correctly. If any tilemaps do not match the layout of the rule tile, an error will appear in the console window. Afterwards, a new rule tile based on your configuration will appear in the same directory as your Auto Rule Tile Asset object.

Randomized Tilemaps

While you can use a single tilemap with the Auto Rule Tile Generator, the true magic lies in utilizing multiple tilemaps. This allows you to introduce randomization into your rule tile, creating a more natural and visually diverse appearance for your tilemaps.

For a great example (and the inspiration behind me making this tool), check out this article on Celeste tilemaps by Aran P. Ink. You can see the before an after of a single tilemap vs randomized variants here:

Single Tilemap
Randomized Variants

Conclusion

The Auto Rule Tile Generator allows Unity developers to create visually interesting tilemaps with much more efficiency. By automating the task of sprite assignment, you can focus on the more creative aspects of game development.

I encourage you to download the Auto Rule Tile Generator and explore what it can do. Feel free to leave a comment below if you have any questions or feedback. (Or open up a GitHub issue.)


Mitchell Opitz

Mitchell is a dedicated web developer with a flair for creativity, constantly exploring new horizons. Dive into his journey through web development, Arduino projects, and game development on his blog: MitchellOpitz.net

Tweet
Share
Share