Best way to draw squares of changing colors?
Hi, so basically I'm doing a simulation of Conway's Game of Life in Unity, and I was wondering how I could show each pixel/cell.
I thought about having a plane GameObject per cell, and have its texture be black if it's dead and white if it's alive, and change it whenever the state of the cell changes. However I read that changing textures often in runtime is very inefficient, so I went with the OnDrawGizmos() function (specifically DrawCube() function). It appears to have a decent performance (2 milisecs to draw a 64x64 grid, when the optimised calculation of said grid each generation is around 1.5 milisecs).
Does this have any repercussions? Since I'm accesing some variables only defined in runtime inside the OnDrawGizmos function it does show an error output while compiling, but as soon as the app starts it shows no error messages and functions correctly. Also, should I switch to GameObjects anyway, or is there a better alternative?
Your answer
![](https://koobas.hobune.stream/wayback/20220613003047im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Unity locks up when drawing WireCubes 0 Answers
.Exe gets slower over time 0 Answers
Cross-Scene Simulation? 0 Answers
FPS drop beacause Dialog with 200 images in it 0 Answers
AMD RYZEN 1800X or Intel i7 7700K? 2 Answers