0
\$\begingroup\$

I'm making a car and I want to make lightable icons on its panel. I want to add 'on' and 'off' effect to them separately. The Sprites are plane objects, with one material and UV texture for each plane.

If I change material property - it will change in all objects which use this material. I don't think creating 10 materials for 10 sprites is the best choice, what should I do in this situation?

enter image description here enter image description here

\$\endgroup\$
  • \$\begingroup\$ Sprite like a plane object, with one material and UV texture for each plane. And i want to make them flash separately. Like on car dashboard. \$\endgroup\$ – Stas Garcia Sep 19 '16 at 15:06
1
\$\begingroup\$

Make each icon a separate game object with its own Renderer. You can use the same material for all of them when you create a texture with all the icons and then use the UV coordinates of each plane to only show the icon it is supposed to represent.

Create two versions of the material, one for "on" and one for "off". Then you assign the appropriate material to the buttons when they are on or off.

Alternatively you can add a script to the icons which uses renderer.SetPropertyBlock to set individual properties for the renderer of that object. You can use that to change the albedo color and/or emission color without creating a duplicated material or affecting the other renderers.

\$\endgroup\$
  • \$\begingroup\$ Ok, i'll try it out. \$\endgroup\$ – Stas Garcia Sep 19 '16 at 15:17
  • \$\begingroup\$ Yeah, it looks really good, i understood SetPropertyBlock. Looks pretty good even without unity adjustments (posted apicture) \$\endgroup\$ – Stas Garcia Sep 19 '16 at 16:01
  • \$\begingroup\$ Additionally if you want the buttons / whatever to "glow" (emit their own light) add an emissive map. Note that emission light isn't considered as a light source (will not cast shadows and will not illuminate other objects). \$\endgroup\$ – Draco18s Sep 19 '16 at 19:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.