- Home /
Question by
innohreloza2000 · Feb 10 at 03:19 PM ·
materialcolorspriterenderer
,Sprite Successfully Color changing in Shader Graph but not in code
,Hi I am using a shader that allows me to change the color of the sprite. I chose to do this because I am also putting an outline of a different color and I don't want the sprite's color to affect it.
So this is what happens. _SpriteColor determines the color where it will be changed into. As you can see below, the color changes both in the main preview and the actual editor. But when I try to change the color using code :
this.gameObject.GetComponent().material.SetColor("_SpriteColor", colorScheme.enemy);
In Color Scheme:
Blockquote enemy = new Color32(219, 124, 112, 255);
I've tried debug logging and it does change the value but the color itself does not. How come?
screenshot-2022-02-09-203651.png
(117.2 kB)
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220613052815im_/https://answers.unity.com/themes/thub/images/avi.jpg)