Search Unity

  1. We are migrating the Unity Forums to Unity Discussions by the end of July. Read our announcement for more information and let us know if you have any questions.
    Dismiss Notice
  2. Dismiss Notice

Question The behavior of batch sizes in BatchRendererGroup

Discussion in 'Graphics Experimental Previews' started by Baggers_, Aug 17, 2020.

  1. Baggers_

    Baggers_

    Joined:
    Sep 10, 2017
    Posts:
    98
    This is a two-parter, the first relating to max instances and the second to resizing batches without recreating them.

    Max Instance Size

    Many parts of Unity only allow 1023 instances per call (e.g. DrawMeshInstanced). Is this also true for BatchRendererGroup?
    I'd assume it was, but some things don't have this limit (e.g.DrawMeshInstancedIndirect)

    On Resizing


    I've done a little experimenting with SetInstancingData and noticed that increasing the instanceCount did not resize the underlying collections. This for example, if the batch was size 5 and I change the instanceCount to 10 and try and write to element 7, it will error.

    From this I've assumed that it's valid to set the value lower but not higher, is that correct?

    If so, that works well for me, I have a small fixed amount of per-frame variability in instance count, and this would let me size the batch to cover that.


    Thanks folks

    p.s. I'm not sure where questions for BatchRendererGroup really belong. Happy to move this if needs be
     
  2. Baggers_

    Baggers_

    Joined:
    Sep 10, 2017
    Posts:
    98
    Can confirm max batch size is 1023