Is it possible to use RuleTile at runtime?

I am creating a system to generate a 2D tile map at runtime. Before I start to implement my own logic to set tiles depending on neighbour tiles, I was wondering if it is some how possible to use Unity’s Rule Tile from the 2D extras package?

As far as I know the Rule Tile are only available in the Editor. Is there a way to use it at runtime?

1 Like

Do you mean paint the Tilemap yourself with RuleTiles? Yup, totally possible: myTilemap.SetTile(cell, someRuleTile). They will check the rules you’ve defined and select the correct sprite just as it does in Editor.

Do you mean create a new RuleTile procedurally at runtime? Yeah, there should be no reason you couldn’t do that but it might be more work than setting up new RuleTiles within the Editor.

1 Like

Thanks it works now.
There was a reference problem in Visual Studio - so I was unable to find the class RuleTile.