Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: daifan on March 21, 2017, 02:51:36 PM

Title: BUG: UIPanel redraw drawcall bug
Post by: daifan 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)
                {
Title: Re: BUG: UIPanel redraw drawcall bug
Post by: ArenMook on March 21, 2017, 04:45:16 PM
Thanks!