I’m creating a 1000x1000 3D playfield, like a map, of hexagon tiles. They look great in smaller arrangements.
Trivially I could write a script to precreate all of the tiles, but that’d be 1M tiles. I presume that’s bad, and that I should be creating/destroying them on a dynamic basis as they enter the camera view, but…
…premature optimization being the root of all evil, I don’t know how expensive it is or isn’t for the unity engine to keep track of 1M things that are 99% offscreen. Maybe it’s a reasonable approach, so I thought I’d ask.
What’s the right approach for a top-down view of a large tiled floor?
Closest example would be the background in Slither.io or Geometry Wars, where it’s large but not inifinite.
Your approach is not going to work.
Are you planning on using lightmaps or realtime GI?
I can tell you that trying to use baked GI or realtime GI for 1 million floor tiles is not going to work out too well.
I would look into a mesh combine utility on the asset store.
Create a couple hundred floor tiles. Combine it into a single mesh. Then duplicate that in the editor.
I wound up creating just enough patches to cover the back buffer, tiling them, and then moving them as needed when the camera moves. It’s more work, but I think it’s the right thing to do. Then at least I’m always running at “worst case” and don’t need to worry if I want to make the “world” bigger, because it scales just fine.