Customized Tiles in Unity


Good moraftnevening Internet! Here's another little devlog on the tools used to make T-SOL. This time about working around the shortcomings of Unity 3D's built-in tile editor.

Out of the box the tile editor in Unity 3D is rather lacking in features. In particular placing tiles that follow a repeating pattern that's made of more than one tile requires painstakingly placing each tile that makes the pattern. It's not possible to use the handy giant rectangle tool or flood fill.


Thankfully Unity has allows customization of tiles so they're not just dumb image. Even better Unity has a handy package with pre-made custom times which addresses some of the problem of blending tiles seamlessly. The RuleTile is perfect for setting up tiling of things like connected pipes, large platforms and so on. But the RuleTile is still lacking in versatility. As soon as you want to add details within a large block of RuleTiles you're now stuck as RuleTile can only combine smoothly with itself. Enter RuleOverrideTile?

For me: no. For some reason a RuleOverrideTile doesn't actually match the RuleTile it overrides causing ugly results. The override seems to be an all-or-nothing affair which isn't helpful for me. To solve the problem my first resort was to create a customized RuleTile called the SiblingRuleTile. Unlike the regular RuleTile the SiblingRuleTile is able to treat any tile in its sibling list as if it were part of the rule. This means decorative features blend into each-other nicely. For example the connectors on these pipes.


This still has its downsides. Every SiblingTileRule needs to be made aware of every other SiblingTileRule it is supposed to blend with. Setting the matching rules is a pain in the butt too when both the primary feature and decorative one are rules cover multiple tiles. For example the rules for these tanks. Getting the windows to work right took way longer than I liked.


In addition to SiblingRuleTile being a little annoying to set up and use they're also useless for a major background feature of the CyberSkull Factory.  A pattern of green hexagons that's two tiles tall and one tile wide. You can see it in the dark background above. Rule tiles are only able to pick the image of a single tile based off of the tile type next to it instead of the tile's sprite. So what now? I could just accept that multi-tile patterns will be tedious to set up forever but that's no fun. I'm also lazy. So let's fix this with code.


This may look a little similar to a RuleTile but it's quite different under the surface. This tile does matching against specific sprites to determine whether or not a rule actually applies. Unlike SiblingRuleTile, SpriteRuleTile does not need to be aware of what specific tile was used to create a particular sprite shown in the level. This should make setup much less error prone. Also, thanks to checking sprites, it's possible to define alternating patterns of tiles using the rule. It's pretty handy!

Get T-SOL - Early Access Demo

Leave a comment

Log in with itch.io to leave a comment.