x


Reducing Draw calls?

Now I know it may be out there, but I cannot find a good example or specifics on how to reduce my draw calls for the below mentioned code:

public Transform brick;

ArrayList road; float difficulty; // Use this for initialization void Start () { difficulty = 20f; road = new ArrayList(); for (int i = 1; i < 5; i++) { for (int j = 0; j < 21; j++) { Transform temp = (Transform)Instantiate(brick, new Vector3(-2.5f+i,0,0.5f+j), Quaternion.identity); road.Add(temp); } }

for (int i = 1; i < 5; i++) { for (int j = 0; j < 21; j++) { Transform temp = (Transform)Instantiate(brick, new Vector3(-2.5f+i,3.05f,0.5f+j), Quaternion.identity); road.Add(temp); } }

for (int i = 1; i < 4; i++) { for (int j = 0; j < 21; j++) { Transform temp = (Transform)Instantiate(brick, new Vector3(-2.05f,-0.45f+i,0.5f+j), Quaternion.identity); //temp.transform.localScale = new Vector3(.25f,1,1); temp.transform.Rotate(Vector3.forward * 90); road.Add(temp); } }

for (int i = 1; i < 4; i++) { for (int j = 0; j < 21; j++) { Transform temp = (Transform)Instantiate(brick, new Vector3(2.05f,-0.45f+i,0.5f+j), Quaternion.identity); //temp.transform.localScale = new Vector3(.25f,1,1); temp.transform.Rotate(Vector3.forward * 90); road.Add(temp); } } }

I have tried assigning a parent object with the combine children script and it did not work. Sorry for the newbie question.

more ▼

asked Jul 31 '12 at 12:07 AM

heretic619 gravatar image

heretic619
4 2 3 4

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first
more ▼

answered Aug 01 '12 at 08:24 AM

oxium gravatar image

oxium
181 6 8 10

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x35
x10

asked: Jul 31 '12 at 12:07 AM

Seen: 884 times

Last Updated: Aug 01 '12 at 08:24 AM