Closed jatkinson16 closed 3 years ago
Hi, when you call SetTile with the RuleTile, the RuleTile should update all the positions around it, as defined in RuleTile.RefreshTile.
Could you share an example of where the RuleTile does not work and what Tiles are placed around the RuleTile?
Is it possible to manually force a rule tile to recheck the tiles around it and update its sprite accordingly? I'm planning on having tiles get removed from tilemaps due to player actions in the future so that would also benefit from the answer.
You can call Tilemap.RefreshTile with the given positions to update those positions if you need to. However, the RuleTile system should update the Tiles automatically for you when you call SetTile.
The rule tile works as normal in the tile palette
But this is the outcome when the tiles are placed in a script(with the script looping from 0,0 to 56,32)
I can assume that initially the tiles won't appear as they should when the script is still going through each coordinate placing tiles but their appearance ends up as the top corner tile regardless.
That bottom left tile in the runtime image surely fulfils the condition for this rule tile, not the one it appears as
The RuleTile should update itself whenever the neighbour is placed next to it, just like what you see in the Tile Palette.
Would it be possible to share the full configuration for the RuleTile as well as the script for placing the Tiles?
If you could, could you try importing the Dungeon RuleTile sample from the Unity Package Manager (or copy the assets from Samples~/DungeonRuleTile to your project) and see if you get the same behaviour when using the script for placing the Tiles with the Dungeon RuleTile?
I managed to figure it out thanks to checking with the sample rule tile. It was an issue on my end with how I set up different spritesheets, I removed the method call and the rule tiles were drawn properly. So it was just my fault in the end. Thanks for the help regardless, this package is a great tool for 2D games!
I've just started using rule tiles in Unity 2019.4 and I'm working on a procedurally generated tilemap that uses rule tiles. It use the standard
tilemaps.SetTile(new Vector3Int(x, y, 0), ruleTile);
to assign the tiles to tilemap positions but when the game runs the tiles don't adapt to those around them.Is it possible to manually force a rule tile to recheck the tiles around it and update its sprite accordingly? I'm planning on having tiles get removed from tilemaps due to player actions in the future so that would also benefit from the answer.