Unity Texture2D Performance eficiente Dibujar píxeles
var pixels = myTexture.GetPixels32();
for (int i = 0; i < pixels.Length; i++)
{
pixels[i] = Color.black;
}
// Draw ants
foreach (Ant ant in ants)
{
for (int i = 0; i < cellSize; i++)
{
for (int j = 0; j < cellSize; j++)
{
// TODO: calculate the index of the pixel in the flat array
// Not 100% sure on that one tbh ;)
var index = (ant.thisX * cellSize + i) + myTexture.width * (ant.thisY * cellSize + j);
pixels[index] = Color.white
}
}
}
myTexture.SetPixels32(pixels);
myTexture.Apply();
Fancy Frog