x


How to batch draw calls for instantiated Prefabs

alt text

In my case i have a self modeled tree, each of my trees is instantiated via another script. The tree models have identical braches, but a single draw call per branch.

How would i go about batching these draw calls as the are instantiated even the tree models themselves?

Cheers - C

more ▼

asked Mar 16 '11 at 12:33 AM

Caiuse gravatar image

Caiuse
787 83 104 122

CombineChildren.cs just found it, its a god send!

Mar 16 '11 at 12:55 AM Caiuse

But the question still stands for instantiated objects.

Mar 16 '11 at 12:56 AM Caiuse

CombineChildren is not as good as static batching, though it's better than dynamic batching.

Mar 16 '11 at 02:20 AM Jessy
(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

I think running combineChildren on the individual tree/branches THEN try parenting them as a child of a GO and regenerate the static batching. You could also create a new prefab runtime (I think) before adding them to the static world

eg

GameObject newThing = (GameObject)Instantiate(thingToSpawn, position, rotation);
newThing.isStatic = true;
newThing.transform.parent = root.transform;
// Spawn everything else too

StaticBatchingUtility.Combine(root);
more ▼

answered Jun 22 '11 at 08:23 PM

Vectrex gravatar image

Vectrex
116 1 1 6

(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:

x1682
x1260
x115
x110

asked: Mar 16 '11 at 12:33 AM

Seen: 3358 times

Last Updated: Jun 22 '11 at 08:24 PM