Over the weekend I got obelisks stacking programmatically. You’re able to sort through all the tiles on a tilemap a couple of ways in unity and I had to try a few. Initially I was getting the bounds of a tilemap using -
and then getting all of the tiles from that using -
which gives you an array that you can loop through, except whoops, then you don’t have the grid co-ordinates of the tiles you’re looking at. I’ve switched to this which seems to mostly be working?
it finds tileBases, which you can then get Tile from, which has grid coordinates and the name of the sprite the tile has (or null). For some reason though, it’s not finding a couple of tiles I’m looking for at the bottom of my map. Are they out of bounds? It’s possible groundMap size is drawing the right sized rectangle of bounds, but only using positive numbers, so the bounding rectangle I am checking is shifted off to the right and up (I’m actually pretty sure that’s what’s happening) so I’ll have to offset the bounds to be centered. I’ll need a nap before I can figure that out.