Highlighting or dulling objects at runtime

I’ve probably seen this question asked a dozen times, but the answers always seem to expect the user to understand something that I clearly don’t.

Basically, I want to be able to either brighten a character (give it a little glow) or dull it (make i semi-grayscale) at runtime. From what I have read, it seemed that the way to do this was to make a shader, assign its properties to what you want them to be, then change it in code like this:

this.GetComponent().material.shader = Shader.Find(“Custom/DullShader”);

However, doing so has no affect on the visuals. What am I doing wrong?

If that line of code is executed successful, you should see the shader of this material is changed.
Then you can check the shader code in “Custom/DullShader” to see if everything is OK.
Could you post the “Custom/DullShader” shader source code ?

1 Like

There’s a ton of code, but I didn’t actually do anything with it. I just dragged a texture into the Albedo property and saved. Do you want all of the code that was generated by that process?