Grid of gameobjects vs SetPixel

For basic 2D tiled games I’ve always been setting up a 2D grid of quads or recently with 4.3 sprites. I’ve never had a problem with this system for small sokoban or puzzle games or just simple roguelikes without any major ai or mechanics. Anyway, I was hoping to move onto my next major project using a 2D grid of 10x10pixel sprites with a fixed resolution of 320x180.

So basically I would have a 32x18 grid gameobjects with a sprite renderer attached. My sprites are simple black and white sprites (old school ascii but with a couple of original’s thrown in), I have 2 layers to the grid so in total 1152 gameobjects with sprite renderers in the scene. The background grid basically with 10x10 sprites of solid colour and the foreground grid drawing the ascii sprites. On top of that I will have a couple of actors that will have their own gameobject in the scene, however all gameobjects will be instantiated at load time.

TL;DR, I’ve been using a layers of sprite gameobjects in a grid to do my 2d games.

I was wondering, as the game gets more complex am I better of using SetPixel for this project where I will only be using Apply once each Update() call?

Also is there a convenient way for me to make the black parts of my sprite one colour and the white parts another?

Sorry if this question isn’t very well written, its much past my bed time…

SetPixel is likely not the answer.

  • More efficient is to use a texture atlas and change the uv coordinates of your quad. A bit complicated but not hard to hand-code, but third-party UI systems like NGUI and EZGUI will automate this process.
  • Even better is to build many quads out of a single mesh and use uv coordinates to map the quads to textures in a texture atlas.

Search for ‘Unity3d Atlas’.