Search Unity

Resolved Invalid conditional expression in custom function

Discussion in 'Shader Graph' started by Chris-Trueman, Jan 22, 2021.

  1. Chris-Trueman

    Chris-Trueman

    Joined:
    Oct 10, 2014
    Posts:
    1,261
    I am following https://blogs.unity3d.com/2019/07/31/custom-lighting-in-shader-graph-expanding-your-graphs-in-2019/.

    I add the custom function and set it up as shown. With the first method using a string it gives me Invalid condition expression when I hover over the little red folder icon with an exclamation point on it and the console outputs this error:

    MissingMethodException: UnityEngine.UIElements.StyleLength UnityEngine.UIElements.ComputedStyle.get_width()
    UnityEditor.Experimental.GraphView.IconBadge.ComputeTextSize ()

    If I switch it to the hlsl file method it gives the same error above but I get a second error that tells me where it is in the hlsl file. It points the the first { which is for the method declaration, there is no conditional expression defined at that point.

    Did something change, or is this a bug?

    Using 2020.2.0f1 and URP 10.2.2.
     
  2. Chris-Trueman

    Chris-Trueman

    Joined:
    Oct 10, 2014
    Posts:
    1,261
  3. Slock20969

    Slock20969

    Joined:
    Nov 18, 2015
    Posts:
    15
    Thank you for putting the fix here after fixing it. I couldn't figure out what I was doing wrong.
     
    White-Dwarf and Chris-Trueman like this.
  4. White-Dwarf

    White-Dwarf

    Joined:
    Dec 28, 2020
    Posts:
    1
    Thanks man, was exactly my problem
     
  5. unity_23ahmedmahmoud

    unity_23ahmedmahmoud

    Joined:
    Nov 24, 2018
    Posts:
    3
  6. tomchancat

    tomchancat

    Joined:
    May 31, 2019
    Posts:
    2
    awesome ! "PointLights_half" problem. I had some problem with a new shader wokring on old 2020 version, you are my life savior