- Home /
All objects are getting transparent ?
I've written a code for enabling animator and created an animation that devrases alpha level of the object's shader (Transparent/Diffuse set) but when i do, everything get's transparent. I mean, I'm using prefabs and all clones which uses that texture gets tranparent. What shall i do ?
Answer by VesuvianPrime · Sep 11, 2014 at 11:46 AM
Hey Alp
The problem is that you are changing the alpha level of a shared material.
Keep in mind that trying to modify the alpha for a lot of objects indepenantly can be expensive. You need to create a new Material instance for each renderer, and this is going to eat up draw calls.
But i want to change only one prefab's alpha level :/ How can it be possible ?
Duplicate the material (ctrl-D/cmd-D) for each prefab you need to be different from the baseline, drag the modified ones to the respective prefabs and apply the changes. Like VesuvianPrime said, it can get expensive. But if you basically only need one transparent variant, that's two materials total.
You can also exploit the vert colors of the mesh to get transparency