Search Unity

Batching lightmapped prefabs

Discussion in 'Universal Render Pipeline' started by matthewhxq, Nov 5, 2020.

  1. matthewhxq

    matthewhxq

    Joined:
    Jul 6, 2015
    Posts:
    21
    Hello,
    I have many buildings (prefabs with models and stored lightmaps) spawned dynamically on map.
    Now in Unity Editor during play mode, everything is bached correctly, but on android build, every prefab is drawn as additional drawcall. Frame debugger says it's because those objects are lightmapped. Thing is, why are those batched in editor but not on android?
    Every prefab uses the same lightmap texture and the same material.
    (lightmapped prefabs solution simillar to this: https://unity.com/how-to/advanced/optimize-lighting-mobile-games#setup-and-static-batching)
    Attached image presents differences between two drawcalls of two identical prefabs spawned next to each other on scene
    Info:
    Unity Editor 2020.1.5f
    SRP Batcher enabled
    Dynamic Batching enabled
    API OpenGLES 3
    Thanks!
     

    Attached Files:

    Last edited: Nov 5, 2020
  2. DeMexi

    DeMexi

    Joined:
    Dec 5, 2017
    Posts:
    18
    I'm experiencing the same. Did you find a solution?
     
  3. matthewhxq

    matthewhxq

    Joined:
    Jul 6, 2015
    Posts:
    21
    Sorry for the late reply.
    Yes I managed to "fix" this, by creating my own shaders with amplify shader. It's only happening on default URP shaders. don't know why.
     
  4. emrys90

    emrys90

    Joined:
    Oct 14, 2013
    Posts:
    755
    I'm having this same issue, batches fine in the editor, but on Android its not batching. Is this a bug that Unity can fix?