Rotating Tiles in Tilemaps Programmatically

I’m trying to create Tilemaps programmatically. I’m creating a new Tilemap; instantiating a new Tile; using Addressables to load in a sprite; adding the sprite to the new Tile; then using SetTile() to place that tile into the Tilemap.

However the only way I can figure how to rotate the graphic programmatically is to work with Matrix4x4s in the Tile object. Which I am prepared to learn how to do on my own, however the Unity documentation seems to imply it shouldn’t be necessary for something as seemingly simple as rotating a tile graphic.

So am I missing a more obvious solution? How am I supposed to rotate graphics on a Tilemap programmatically?

I think if you rotate it in the editor, then study the matrix, you’ll find that’s exactly how they rotate it too.

This part of the API should help: Unity - Scripting API: Matrix4x4.TRS

You can supply a Quaternion.Euler(0f, 0f, 90f) … or 180, or 270 etc to test using tilemap.SetTransformMatrix()

I’ll work with the Matrix4x4s directly then, thanks for the tips!