Assign material to second UV map

Hiya all,

I've got a mesh which contains two UV sets and one material (diffuse). At runtime I assign a second material (Transparent/Diffuse) to this mesh using the following code in the Start() routine:

obj.renderer.materials = new Material[]{obj.renderer.material,secondMat};

However, both of these are mapped using the first UV set.

Question: Is there any way I could make it so that material #1 uses UV Set #1, and Material #2 uses UV Set #2? Would I have to write my own shader?

You're just assigning two materials to the same renderer, which doesn't have anything to do with UV sets. Making a texture use the second UV set requires an appropriate shader.