Unity URP Shader “Redefinition of _Time“ error

It is strongly recommended to try reading this article first and then solve it yourself: https://zhuanlan.zhihu.com/p/360566324
I will record my thoughts here:

  1. First check whether the URP upgrade is correct, mainly to see whether the Asset is set and whether the ShaderGraph behaves normally.
  2. Try to rule out whether the problem is caused by undefined macros, mainly comparing the code automatically generated by ShaderGraph.
  3. Confirm whether your code uses HLSLPROGRAM (this must be used in URP, if you don’t use the Shader you wrote, it is actually the Build-In pipeline)
  4. There cannot be fixed in the code! ! ! , there cannot be cginc files! ! ! , very important, it is fixed. Even if you do not use CGPROGRAM, it will default to you using it, which will cause the definition in the build-in pipeline to be referenced by default, thus triggering redefinition.

Guess you like

Origin blog.csdn.net/qq_37421018/article/details/128327671