- Home /
Easy (material?) way of changing a sprite's color
Greetings.
Say, you've got a sprite of a car's body. It's white, however you'd like to make it greenish. Give it a green 'overlay', you get it. A greenish tint. Without bringing another sprite to Unity, and possibly its animations.
Is it possible to turn it greenish solely by using things that are built into Unity? Materials, Shaders, sprite manipulation, whatever.
Thanks!
Answer by RobAnthem · Mar 18, 2017 at 08:06 PM
Well you could always do this with code. The sprite is managed by the SpriteRenderer component.
public class SpriteColorer
{
private SpriteRenderer sprite;
public Color color;
void OnEnable()
{
sprite = gameObject.GetComponent<SpriteRenderer>();
ChangeColor();
}
public void ChangeColor()
{
sprite.color = color;
}
}
Thank you, didn't know about the ingenious SpriteRenderer.color
Your answer
Follow this Question
Related Questions
Multiple Sprite animations 1 Answer
Using animated transform to push object away? 2D 0 Answers
Animated Tile control 0 Answers
Multiple 2D characters with the same animations? 0 Answers
2D Cloud Animation 1 Answer