I know that Properties apply to a single shader. I was wondering whether there exists the concept of a global piece of information that can be set once and accessed by all shaders that need it. In particular, I want to use the player location to create a transparency cutout through objects between the player and the camera. Camera location, fragment location are fine. But to calculate whether something is visible or not, I need the player location. As several shaders may be involved, it would be a little inconvenient to set a player location for each object’s shader every time the player moves.
Thanks! So do I declare the global in the Properties or is it something special?
No, you don’t need to declare it in the Properties
section. Just declare the uniform in your shader pass, the same way you’d declare other uniform values :
sampler2D _MainTex;
float4 _MyGlobalVector;
// etc...