x


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?

more ▼

asked Apr 18 '10 at 10:00 PM

Kiloblargh gravatar image

Kiloblargh
1k 33 54 70

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

You have to actually specify a Color. As in Color(1.0, 0.0, 0.0) or Color.red.

more ▼

answered Apr 18 '10 at 10:41 PM

Eric5h5 gravatar image

Eric5h5
80.3k 42 132 521

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x507
x427

asked: Apr 18 '10 at 10:00 PM

Seen: 1747 times

Last Updated: Apr 18 '10 at 10:00 PM