0
Planned

Distance node causes errors when plugging in inputs with different component counts

Tomáš Mariančík 10 years ago updated by Freya Holmér (Developer) 10 years ago 1
Admin edit: Changed the name of the topic
Original title: Shader program had errors - unable to find compatible overloaded function
Original post below:


Hello, I've been playing with the Shader Forge and I'm really happy with it, but I managed to create node configuration that gets compiled by Shader Forge, but the resulting shader won't get compiled by Unity. I'm not sure if this is a bug or if I did something wrong. Here are some of the errors for quick overview:

Shader error in 'Shader Forge/Test': Program 'frag', unable to find compatible overloaded function "distance(float2, error)" at line 66
Shader error in 'Shader Forge/Test': Program 'frag', unable to find compatible overloaded function "sin(error)" at line 66
Shader error in 'Shader Forge/Test': Program 'frag', unable to find compatible overloaded function "tex2D(sampler2D, error)" at line 66
Shader error in 'Shader Forge/Test': Program 'frag', undefined variable "TRANSFORM_TEX" at line 66

...

Here's the shader code itself so you can try it:
http://pastebin.com/nnpnhy8g
I see! The issue is that the values you're checking the distance with, has different component counts. One has two components (The UVs), the other has only one (R channel of the texture).

However, it should typecase the Vector1 to Vector2, so it is a bug!

For now, make an append node and append R to R, and plug that into the distance instead :)