Unity-Technologies / 2d-extras

Fun 2D Stuff that we'd like to share!
Other
1.56k stars 344 forks source link

Possible to make rule brushes aware of other brushes? #264

Open nmearl opened 3 years ago

nmearl commented 3 years ago

I have a tile set that has several variations depending on the nature of the neighboring tile. However, I'm not sure of how to make the rule ~brush(es)~ tile(s) aware of this fact.

Is there a way to make a tile not just aware of the fact that there's a neighboring tile, but also what type of tile it is?

ChuanXin-Unity commented 3 years ago

I assume that what you mean as a rule brush is the Rule Tile?

If so, you could take a look at the example/s at https://github.com/Unity-Technologies/2d-techdemos/tree/master/Assets/Tilemap/Rule%20Tiles/Custom%20Rule%20Tile . This contains a custom Rule Tile script with adds or modifies Rules such that they consider whether the neighbour is the same type rather than the same Tile. You can create other custom Rules as well with the Custom Rule Tile script (https://github.com/Unity-Technologies/2d-extras/blob/master/Documentation~/CustomRulesForRuleTile.md).

Let us know if that helps or if what you need is something different!