Changing color of an object | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Changing color of an object

simple: I have a 2d object in Unity, and I want to change it's color. is the only way to do this to Port it to drawing software and change it there, or is there a simpler way to do it.

9th May 2017, 11:41 PM
Bob JoeMan
Bob JoeMan - avatar
4 Answers
+ 2
gameObject.GetComponent<Renderer>().material.color = Color.green; or instead of Color.green you can do new Color (r, g, b);
9th May 2017, 11:45 PM
Edward
+ 1
it could be any script attached to the object you want to change. maybe in the Start method unless you need it elsewhere cause the first variable "gameObject" is the object that the script is attached to
10th May 2017, 2:21 AM
Edward
0
where would I type this? make a new script or change the object's script?
9th May 2017, 11:53 PM
Bob JoeMan
Bob JoeMan - avatar
0
alright thanks
10th May 2017, 10:51 AM
Bob JoeMan
Bob JoeMan - avatar