- Home /
How do I set the color of a light with a script?
Actually it seems more that I know how to do this, but Unity does not.
var light1 : GameObject;
light1.light.color = (1,0,0); //this gives an "expecting ),found ','."
or like this:
light1.light.color = red; //this gives an "unknown identifier: "red"."
And I'm setting the intensity of this same light (dragged to the light1 slot in the inspector) in the previous line, the same way, with no error. What gives?
Answer by Eric5h5 · Apr 18, 2010 at 10:41 PM
You have to actually specify a Color. As in Color(1.0, 0.0, 0.0)
or Color.red
.
Your answer
Follow this Question
Related Questions
Change light color when entering trigger 1 Answer
How can I change the color of a light over time? 3 Answers
Light Looks Weird 2 Answers
Light, halo and color 1 Answer
All my stuff become pink like if a pink light could be there. 0 Answers