I'm a game where you can build things. When placing the things they should be half transparent(a = 0.5) until they are placed. How do I do this? I seen an answer to similar problem is
Color c = renderer.material.color;
c.a = 0.5f;
renderer.material.color = c;
But the problem is the object can contain many meshes with many textures and I want it to be overall transparent, e.g. if an object is a box behind a box, the box behind will not be seen through the front box.
The solution should be rendering everything within the object, halving the alpha, and putting it in the scene, but I don’t know how.
How do I do this?
Edit: I realized this can be done by applying a shader to the object.
But I can only find how to attach a shader to a material.
How do I attach a shader to a whole object?