Accessing shader colors
I am trying to edit the secondary color of a custom shader.
Here's the color i am refering to: http://imgur.com/a/yasvO
here is the shader script with the property I want to edit highlighted: http://imgur.com/a/D2vXw
I can change the color of the material to my desired color, but it only changes the main color. What I want is for the "New Color" to change the outline color.
public void LookedAt()
{
Debug.Log("Object is being looked at by player");
rend.material.color = new Color(255,147,49,255);
}
Thanks in advance :)
Answer by Namey5 · Jul 23, 2016 at 12:36 AM
rend.material.SetColor ("_OutlineColor", new Color (255,147,49,255));
Keep in mind, Unity's colour range is from 0-1 not 0-255.
Thank you so much! this explains why it was rendered white, and thank you for solving the error!
Your answer
![](https://koobas.hobune.stream/wayback/20220612085339im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
What are the key names of the textures on the HD ScriptableRenderPipeline in code. 3 Answers
How do I cell shade terrain? 0 Answers
cant edit shaders? 0 Answers
stop materal instancing 1 Answer
Slime shader (Fall Guys like material) 0 Answers