Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Bug Improve Custom Function Errors / Node Name

Discussion in 'Shader Graph' started by Ziflin, Dec 1, 2020.

  1. Ziflin

    Ziflin

    Joined:
    Mar 12, 2013
    Posts:
    132
    It would be nice if errors using Node / Custom Functions were improved. For instance, I just forgot to put out on the output parameter in my function and the error reported is:

    Shader error in 'hidden/preview/CustomFunction_bbc2d82dbcfe46b29215eff092077f85': variable '_CustomFunction_bbc2d82dbcfe46b29215eff092077f85_Weights_1' used without having been completely initialized at line 168

    This is pretty useless as an error. "Weights" was luckily mentioned in there, but if there were multiple custom functions with the same output name in one graph this would be even more frustrating to fix. Can Unity's shader compiler output a #line directive in its final output so that the file & line number that are logged are useful?

    Also, can the name of the node in the node graph include the name of the custom function? Or is the goal to always have to make a subgraph to wrap a reused custom function?