- Home /
How can I activate a shader at specific times?
Hello! I've run into a problem involving shaders that I'm trying to figure out.
I have some logic to select a vehicle to target. What I want to do is "turn a shader on" when the vehicle is selected. I have the basic texture shader on one material and I added the "selected" shader to another material, but the problem is that both show all the time. I'd like to be able to enable and disable the material/shader without removing the texture shader that I already have attached.
Any help would be appreciated!
Answer by Legion555 · Mar 22, 2014 at 03:04 AM
I dont know if I understood well your question, but in my opinion you should use different materials(each with a specific shader), and then change the material of the obj as you wish.
SkinnedMeshRenderer renderer= GetComponent<SkinnedMeshRenderer>();
renderer.material=matA;
Answer by Lethil · Mar 24, 2014 at 06:13 PM
That disables the other active materials, unfortunately. There are 3 materials on this item, and I need to activate/deactivate one of the 3 materials. The other 2 need to stay active.
Your answer
Follow this Question
Related Questions
Changing Eye Colour (Colour only non-white parts of a texture?) 2 Answers
How can i get my quad to only render my texture without stretching it? 1 Answer
Pass multiple textures(array) into shader 0 Answers
Cannot paint Texture onto Terrain using Custom Material 2018.4 1 Answer
Standard material shader ignoring SetFloat property "_Mode"? 1 Answer