- Home /
Box Collider 2D / Auto Tiling / Flipped sprites / Non-Center alignment
LONG STORY SHORT: I want an auto-tiled Sprite gameobject that, when height is resized with the Tiling settings, it adds / removes from the bottom of the sprite instead of the top. What follows is the edge case I found pursuing it.
LONG STORY LONG:
I have the Sprites used to build the stage itself aligned to Top-left, as to make it easier to assemble them in a grid and as I thought that'd help my problem.
When a Sprite is set to Draw Mode > Tiled, Continuous, changing Height alters the object as if aligned to the bottom, when I wish it aligned to the top.
My first attempt was a rotated / scaled prefab and got the results I wanted, but Unity documentation suggests thats a bad idea. I attempt to do it by Flipping the sprite at the Sprite Renderer component.
As it turns out, that breaks Box Collider 2D; a flipped Sprite flips on its axis, and with a top-left axis its flipped outside the Box's position. Setting the Box to auto-tile generates a shape thats invalid in size. Messing with the offset yields no results.
Setting the sprite's alignment to Center makes harder to build a grid and would invalidate the experiment.
I am aware I could junk the entire process and just use Tile Maps. It still feels like a non-ideal solution, as Tilemaps just generate tons and tons of colliders for each placed tile, and woulsnt allow the occasional disturbance to the grid.