Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No completion in shader graph custom functions #2463

Open
OrangeLightning219 opened this issue Nov 16, 2024 · 0 comments
Open

No completion in shader graph custom functions #2463

OrangeLightning219 opened this issue Nov 16, 2024 · 0 comments

Comments

@OrangeLightning219
Copy link

When writing functions in a separate hlsl file and then using them as custom functions in shader graph Rider doesn't see the global properties defined in the graph. Also Rider complains about unresolved symbols for typical unity shader macros like SAMPLE_TEXTURE2D.

One way to work around this is to pass all the shader graph properties as parameters to the function but it's annoying and still doesn't solve the problem with the macros.

Steps to reproduce:

  • Create a shader graph and add a property - for example SomeTexture with type Texture2D
  • Create a hlsl file and write a function in it:
void TestFunction_float(out float3 color)
{
    color = SAMPLE_TEXTURE2D(_SomeTexture, sampler_SomeTexture, float2(0, 0)).rgb;
}
  • In the shader graph add a custom function node and set it up to use the file and function created in the previous step
  • Connect the custom function node output to the shader base color
  • The shader will compile fine but Rider will complain about unresolved symbols for SAMPLE_TEXTURE2D, _SomeTexture and sampler_SomeTexture

I'm using Unity 6000.0.23f1 and Rider 2024.1.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant