Shader to object reference

is there a possibility to let a shader script access some object information to which it is attached, like layer id? For example I want to let the shader add only background colors from particular objects and not from all of them. My idea is to have some objects with transparent surface which should simulate shadow on the ground, but they should add color only from the background and not from other “shadow object”, because i want to use many of them to have more dynamic shadow behavior.

I would think, worst case, you could have a param on your shader which you could set via, say, Start function. Set it on the renderer’s material (your shader)