I have some code that fills a 20x20 tilemap with tiles. When I do this through scripting the tiles aren't culled outside of the camera's frustrum and there are 400 batches/setpass calls. When I do it through the tile map palette they are. Is there something that has to be set on the Tile object that enables culling?
now that I'm at a computer I can post the code: Code (CSharp): RoomSprite = Sprite.Create(texture, new Rect(0, 0, tSize.x, tSize.y), new Vector2(.5f, .5f), s.pixelsPerUnit, 1, SpriteMeshType.Tight, Vector4.zero, true); RoomTile = ScriptableObject.CreateInstance<Tile>(); RoomTile.sprite = RoomSprite; RoomTile.colliderType = Tile.ColliderType.Sprite; RoomTile.name = name + "_roomTile"; So, I'm building a texture and creating a sprite from it, then creating a tile from that. My Batches show 2 (saved by batching 398). I can't figure out what this is doing differently than painting the tile using the tile palette. I'm just setting the tile using TileMap.SetTile(), so there isn't really anything to that.
After some more testing it seems the behavior I'm seeing is consistent with the tile palette, so all good I guess.