Hi everyone, I would like to change the SpriteRenderers color at runtime via code OR I would be happy with changing the materials tint in the editor. My main goal is to have a color field that I can set in the editor manually and via code, but the problem is that if I set the color of the sprite renderer to gray in the editor, then I set the material color (aka the Tint), end up getting my desired color multiplied by grey. I would be fine with setting the SpriteRenderers color to white and the tint to my default color if I could do so in the editor, but the material is only accessible at runtime it seems. On the other hand, the SpriteRenderer color only seems to be accessible in the editor.
Unfortunately, my only thought is to set all renderer colors to white in the editor, and programmatically apply tint’s at runtime to get the precise colors I want. This makes editing difficult though when everything is the same color
If I am interpreting your question correctly, you just want to be able to programatically change the color of a sprite using its SpriteRenderer.
The following code should be able to accomplish that.
SpriteRenderers have a property called color that can be accessed and changed at runtime.
Thank you Limeoats! I am not sure how I missed this, but I thought for sure I tried it. I do notice that the color in the inspector isn’t updating until I deselect the object and reselect it, so maybe that was throwing me off the path. But alas, your solution works. Thank you!