Answers for "how to change color in unity in script"

C#
5

unity set material color

//Gets the renderer material and sets color
object.GetComponent<Renderer>().material.color = newColor;
Posted by: Guest on June-13-2020
0

change olour in unity script

SpriteRenderer sr;

void Start()
{
	sr = GetComponent<SpriteRenderer>();
}
void Update()
{
	//This is a simple way of adding color
	sr.color = Color.red;
	//This is a more specific way of adding color
    sr.color = new Color(0/*Red*/,0/*Green*/,0/*Blue*/)
}
Posted by: Guest on July-24-2020

Code answers related to "how to change color in unity in script"

C# Answers by Framework

Browse Popular Code Answers by Language