Search Unity

Potentially unintended use of a comma expression (Need help)

Discussion in 'Shaders' started by Smileys, Jun 23, 2022.

  1. Smileys

    Smileys

    Joined:
    Feb 27, 2014
    Posts:
    81
    My shader knowledge is really limited and not having something like intellisense for shaders does make it really hard to fix stuff. I am getting the following error in a really simple "Grid" shader. Could someone with more knowledge than me point me in the right direction?

    Shader Code (Warning at line 7):
    Code (CSharp):
    1.     fixed4 frag (v2f i) : SV_Target
    2.             {  
    3.              
    4.                 fixed r = DrawGrid(i.uv , _GridSize, _GridThickness);
    5.                 fixed b = DrawGrid(i.uv, _Grid2Size, 0.005);
    6.                 fixed g = DrawGrid(i.uv, _Grid3Size, 0.002);
    7.                 fixed4 col = (_Grid1Color.r * _Grid1Color.a,_Grid1Color.g* _Grid1Color.a,_Grid1Color.b* _Grid1Color.a, (r+g+b)*_Grid1Color.a);
    8.                 clip(col.a - _Cutoff);
    9.                 return col;
    10.                 //return float4(_Grid1Color.r * _Grid1Color.a,_Grid1Color.g* _Grid1Color.a,_Grid1Color.b* _Grid1Color.a, (r+g+b)*_Grid1Color.a);
    11.             }
     
  2. kruskal21

    kruskal21

    Joined:
    May 17, 2022
    Posts:
    68
    Smileys likes this.
  3. Smileys

    Smileys

    Joined:
    Feb 27, 2014
    Posts:
    81
    Thanks that fixed it and the explanation link really helped.