Map generation 2D

I can create this: alt text

But i have some performance issues. The generation (which involves instantiating all of the tiles [500x100]) takes 5-10 seconds. I have a feeling that i might do something wrong. Do you have any suggestions to improve my map-generation?

My generation algorithm is: instantiate - change the sprite of the tile where necessary - turn off the boxcollider2d where necessary. It works OK and I have quite a strong computer and I wouldn’t think that it will run acceptable on a mobile device :slight_smile:

Any help appreciated!

PS: The map-generation must be in run time, I would like to have a different dungeon to play in every game.

Instantiating so many separate objects will never work. Your best bet is to use an existing tilemap package which has already solved these problems, but if you want to do it yourself, either create mesh chunks using the Mesh class, or create a pooling system where only visible tiles are created.