If in Material Custom node

Hey everyone,

I’m trying to optimize material I’m working with to not execute Custom node code if certain condition is met. The condition is basically just checking if variable is < 1 (a binary variable, can only have values 0 and 1), however, this variable is computed within the material, which seems to be causing problems.

The moment I write

if(checkVar < 1){
  return 0;
}else {
 //some code
}

the material does not compile (no error message is given). At the same time, when “checkVar” is plugged into via parameter from material instance, everything is working alright.

Any thoughts on workaround here? Thanks in advance.

Enable shader development mode and check for actual error.

ah I wondered where all the error messages go. This seems to be enough to help me resolve the issue, thanks mate