2

I get these warnings whenever I save changes in any shader file. It does not seem to relate directly to the shader files, since it works perfectly in a new project. Unfortunately it seems impossible to open this "Master" shader and edit it, double clicking the error message does not open any file.

Master shader error

I'm using Unity 2021.1.0b11.2079 and the Universal Render Pipeline.

Does anyone know why these warnings appear and how I can solve the root issue?

Thanks a lot!

Lyxodius
  • 344
  • 1
  • 5
  • 12
  • this is a shader you created yourself? Master sounds like Shadergraph. The error says that you truncate some values (cut off everything after the floating points), that does not necessarily mean you get a wrong value but could lead to errors. Without further informations it's hard to say what exactly you are doing and where the errors reside – nkazz Mar 22 '21 at 14:53
  • No, 'Master' is not a shader I created myself. I cannot find the file either, it looks like it's something from Unity itself, since I cannot open it. – Lyxodius Mar 22 '21 at 14:55
  • I actually also get the warnings for some URP shaders like 'Universal Render Pipeline/Terrain/Lit'. It's really weird. – Lyxodius Mar 22 '21 at 15:10
  • 1
    For me this error popped up when I imported a shader that was made in a much older version: do you have some old code somewhere, maybe? – Joachim Apr 27 '21 at 16:06

1 Answers1

1

The warning just means that some components of the vector are being ignored as it is converted to another type with less components(for example float3 to float2). In a script(here HLSL), instead of writing

float3 a = float3(1, 2, 3);
float2 b = a;

(which will give your a warning) you can simply write

float3 a = float3(1, 2, 3);
float2 b = a.xy;

The behaviour is the same, but the warning is gone.

Schuell
  • 26
  • 3