Author Topic: BUG: UIPanel redraw drawcall bug  (Read 1523 times)

daifan

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 14
    • View Profile
BUG: UIPanel redraw drawcall bug
« on: March 21, 2017, 02:51:36 PM »
Recently we encountered a very weird bug in UIScrollView, which when assign different shaders to several UI2DSprite with same texture, those sprites will randomly change to the same shader.

It turns out that in UIPanel FindDrawCall method, it only check material and texture properties, but not check shader property.
This will result in the 2 widgets with null material, different shader, same texture considering to be the same.

Please check the following code:

UIPanel.cs at line 1730

bug one:
          if (dcStart <= depth && dcEnd >= depth)
          {
            if (dc.baseMaterial == mat && dc.mainTexture == tex)
             {
                if (w.isVisible)
                {
         
bug fixed:
          Shader shader = w.shader;

          if (dcStart <= depth && dcEnd >= depth)
          {
            if (dc.baseMaterial == mat && dc.shader == shader && dc.mainTexture == tex)
             {
                if (w.isVisible)
                {

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: BUG: UIPanel redraw drawcall bug
« Reply #1 on: March 21, 2017, 04:45:16 PM »
Thanks!