- Home /
How to batch draw calls for instantiated Prefabs
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
CombineChildren is not as good as static batching, though it's better than dynamic batching.
@Jessy, Does this apply to StaticBatchingUtility.Combine too? (meaning it has it's limitations (documentation says nothing about that))
Answer by Vectrex · Jun 22, 2011 at 08:23 PM
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);
Your answer
Follow this Question
Related Questions
Problems with Batching (diffuse shader) 1 Answer
Excessive VBOs and no batching while instantiating prefabs 0 Answers
Draw calls not batch for simple cube prefab 1 Answer
Changing LocalScale in code affecting prefab stored in Assets 1 Answer
Instantiate a prefab vs create one dynamically at runtime? 1 Answer