I am trying to put more of my shader graph logic into code to get rid of the spaghetti hellscape that its become.
I set a global test in C#:
Shader.SetGlobalTexture("_MyTexture", _myTexture);
Then in my custom node i call this function:
UnityTexture2D _MyTexture;
UnitySamplerState sampler_MyTexture;
void Test_float(float4 screenPos, out float3 color)
{
float2 uv = screenPos.xy / screenPos.w;
color = _MyTexture.Sample(sampler_MyTexture, uv).rgb;
}
But i get this error:
ps_4_0 does not allow textures or samplers to be members of compound types
What is the correct way to set this up for globally set textures? How does Unity do it for sampling Scene Depth for example?