title: Unity 2D Tilemap Custom Hexagonal Rule Tile
body: <p>I'm looking for a way to create a new type of hexagonal rule tile to do something rather simple and specific. I want to create a hex rule tile capable of automatically choosing a sprite based on which other types of hexagonal tiles are adjacent to it. The default hexagonal rule tiles allow you to specify the sprite when a given tile is bordered by that same tile type on each side, but this is insufficient for my purposes.</p>
  <p>What I ultimately want is to create a coast tile that will detect which sides are bordered by ocean tiles and choose the correct hex sprite based on that. Something like this, but with the ability to specify ocean tiles, not just the same tile type as indicated by the green arrows:</p>
  <p><a href="https://i.stack.imgur.com/7Ku4j.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/7Ku4j.png" alt="Coast tile example" /></a></p>
  <p>I can see Unity's default code for hexagonal rule tiles in their github repo, but have no idea how to go about overriding this exactly:
  <a href="https://github.com/Unity-Technologies/2d-extras/blob/master/Runtime/Tiles/HexagonalRuleTile/HexagonalRuleTile.cs" rel="nofollow noreferrer">https://github.com/Unity-Technologies/2d-extras/blob/master/Runtime/Tiles/HexagonalRuleTile/HexagonalRuleTile.cs</a></p>
  <p>This is a relatively new subject in Unity, but any help or guidance would be much appreciated.</p>