Search Unity

Scrollview Mask breaking batch?

Discussion in 'General Graphics' started by Ljaljevic1120, Feb 1, 2020.

  1. Ljaljevic1120

    Ljaljevic1120

    Joined:
    Jul 15, 2019
    Posts:
    85
    I have some UI with a scroll view set up like this:

    ▾ Scroll View
    ▾ Viewport
    ▾ Content
    Scrollable UI
    More Scrollable UI

    The viewport has a mask component that uses a stencil to mask the scrollable UI. My issue is that the UI being masked has an instance of this stencil automatically applied to it, and it can't be edited. Because of this, My batch is breaking due to 'Different material instance'.

    It's important for the batches to batch because it's an Android-based game.
    How do I solve this?
     
  2. ali-but

    ali-but

    Joined:
    Apr 3, 2018
    Posts:
    19
    did manged to figure out what was causing this issue?
     
  3. Ljaljevic1120

    Ljaljevic1120

    Joined:
    Jul 15, 2019
    Posts:
    85
    I did not figure out how to fix this. I just ignored the issue and eventually, the final build ran perfectly smooth.
    I am still trying to find out how to solve this though...
     
  4. ali-but

    ali-but

    Joined:
    Apr 3, 2018
    Posts:
    19
    In my case, I found out the Z value was no zero for the scroll view and it was not allowing anything to batch under it.

    I also learned that whenever there is mask a new batch was created but everything under the mask game object will batch if Z is set to zero. Now that mask is breaking the batch then I decided to make scroll view a separate Canvas so it doesn't recreate the whole UI on scroll.