Search Unity

Dynamic Batching troubles reloaded

Discussion in 'Editor & General Support' started by Zimbo, Jul 17, 2012.

  1. Zimbo

    Zimbo

    Joined:
    Jul 11, 2012
    Posts:
    8
    Situation: a Planet with buildings and food.

    I have a sphere, serving as a planet. Procedurally (C#) I construct 2 groups of Prefabs. One is a set of buildings, consisting of max 10 planes each with max 10 vertices, the second is a group of "candy food", just 2 dimensional sprites with 4 vertices. Each 10 seconds some new food will spawn somewhere on the planet.
    All the stuff uses the same material, with the iPhone Sprite Shader and just one texture (atlas) of 1024 x 1024 pixels.
    The right conditions for a some automatic dynamic draw call batching, I figured.

    Problem: Weird batching behaviour.

    When I disable the buildings, and just enable the spawning of the food, the # of Draw Calls is stable (dynamic batchin works).

    When I disable the food spawning, and enable the buildings - I put 30 buldings on the planet in Awake - the # of draw calls is stable as well.

    But... when I enable both, the buildings and the food spawning, the # draw calls increases around each 5 seconds. Now the batching (for the food) breaks. By the way, this does not happen when I don't give the food Prefabs a sharedMaterial (but instead of the food graphics, purple rectangular planes are displayed. nobody wants this;)

    I cant figure out why the # of draw call increase.
    Does anybody encountered something like this? Please help. Client wants game soon on touchtable and iPad.

    Zimbo

    Windows 7, Unity 3.5.3f3, modern graphical card.