这种代码和节点结合的方式也挺不错的,哈哈😄,可能后面会改进吧
https://blogs.unity3d.com/2019/07/31/custom-lighting-in-shader-graph-expanding-your-graphs-in-2019/?_ga=2.75716309.1595341088.1607915450-1061131448.1551936980#comment-417933
后面还有可以从文件获取的方式,也挺不错
现在SG可以生成代码了,很像ASE 但是还是不能直接生成shader,可以作为参考看看
另外如果遇到一些bug可以用SG验证一下,看看SG是不是也有这个bug
#if SHADERGRAPH_PREVIEW
Direction = half3(0.5,0.5,0);
Color = 1;
#else
Light light = GetMainLight();
Direction = light.direction;
Color = light.color;
#endif