- Home /
This post has been wikified, any user with enough reputation can edit it.
Question by
Toaster123 · Dec 17, 2014 at 02:37 PM ·
4.6draw callsreduce
Reduce Drawcals
I have a grid of cubes like setted up with this code each of the cubes have a wolrdspace canvas to display a sprite if they are not used tu display a digit
void Start () {
var row = new GameObject();
for (int x = 0; x < size; x++)
{
row = new GameObject();
row.transform.parent = transform;
row.name = "Row" + x;
if (x >= 0 && x <= 3 || x >= 36 && x <= 39)
row.isStatic = true;
for (int y = 0; y < size; y++)
{
Vector3 pos = transform.position;
pos.x = x;
pos.y = y;
pos.z = 0;
GameObject o = Instantiate(obj, pos, transform.rotation) as GameObject;
if (x >= 0 && x <= 3)
o.isStatic = true;
o.transform.parent = row.transform;
o.name = "Cube(" + x + "," + y + ")";
objs[x, y] = o;
}
}
wheater.Add("sun", Resources.LoadAll<Sprite>("sun"));
Debug.Log(wheater["sun"].Length);
digits.Add('1', ONE);
digits.Add('2', TWO);
digits.Add('3', THREE);
digits.Add('4', FOUR);
digits.Add('5', FIVE);
digits.Add('6', SIX);
digits.Add('7', SEVEN);
digits.Add('8', EIGHT);
digits.Add('9', NINE);
digits.Add('0', ZERO);
//ApplyTexture("sun");
}
when i set a digit the cubes at the matching position move forward /backward
how would i reduce the neded draw calls
Comment