Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Draw Call Conundrum

Discussion in 'Editor & General Support' started by teknic, Nov 9, 2013.

  1. teknic

    teknic

    Joined:
    Oct 18, 2012
    Posts:
    32
    I have sifted through the many postings on this subject and have not found an answer. Here's the issue:

    Empty scene
    One script which instantiates cubes
    When 100 cubes are instantiated, the draw call count goes to 201. According to the description of the dynamic batching system, these should all be batched into a single draw call.

    The following changes make no difference:

    Marking the source cube static.
    Forcing a shared material after instantiation.
    Disabling shadow casting/receiving.
    Using a cube mesh from an FBX.

    Removing the material reduces the draw calls down to 101.

    What is the explanation for this?
     
  2. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Marking static is wrong if you want dynamic batching (which you need to turn on for it to work). If you use the same material on the cubes, it's shared unless you do something to make each material an instance (such as changing renderer.material.color).

    --Eric
     
  3. teknic

    teknic

    Joined:
    Oct 18, 2012
    Posts:
    32
    Understood. the cubes are identical with a shared material and there is no change to renderer.material.color. Surely there is reason this simple test fails...