Open PtrStruct opened 3 years ago
The RuleTile only recognises itself when matching Tiles around it. Other RuleTiles are treated as different and will not be matched.
This is based on the Rule matching logic found at https://github.com/Unity-Technologies/2d-extras/blob/5a3d43ee48c637bad5ffffa8501fc4fa6f2b136f/Runtime/Tiles/RuleTile/RuleTile.cs#L703 .
You could create your own RuleTile with the matching conditions that you want using Custom Rules.
An example can be found at https://github.com/Unity-Technologies/2d-techdemos/blob/master/Assets/Tilemap/Rule%20Tiles/Custom%20Rule%20Tile/Scripts/CustomTypeRuleTile.cs, where there is a new Rule which matches if the neighbouring Tile has the same Type.
Hope this helps!
So I'm currently working with a Rule Tile which utilizes a Tileset that has a bunch of tiles that are 32x32.
In my scene I have an empty gameobject with a script attached to it (ProcedualGeneration.cs) as well as a "Rectangular Tilemap" which is built using a Grid and a Tilemap as it's childelement.
When I start the project, the script runs and it generates a world by first generating a 2D array which gets filled with 0's, indicating that there is no tile there.
Then it uses perlin noise to calculate where to place tiles. and this all works fine as long as it uses the tiles from the "Overworld" Rule tile.
as shown here
Then if I add another type of tile, for instance.. If I try to add a stone tile which is a different ruletile, to the same tilemap, the tiles from "Overworld" doesnt recognize these as tiles, even though they're in the same tilemap.
A more visual representation would be this.. The tile that the arrow is pointing towards is setup to only generate if there is no tile touching it from above or under, or on the sides horizontally.
Why doesn't it recognize the stone tiles as tiles?
This is how I generate the world on start