x


Accessing material of particle renderer??

Hi

I'm using Unity Indie 2.6.1 and have following code:

function Start () {
    var c = Color(Random.value,Random.value,Random.value,1);
    renderer.material.color = c;
}

If I've understood the documentation correctly this should also work with a particle renderer but I have no reaction at all. It works without any problems with a mesh renderer.

Does anybody have a suggestion what could be the problem?

Thank You!

more ▼

asked Dec 10 '09 at 08:16 PM

Floyd gravatar image

Floyd
34 2 2 5

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

1 answer: sort oldest

The problem is that most particle shaders do not use "_Color" for their main color property.

(material.color is just a shortcut for material.SetColor("_Color", ...))

Most particle shaders right now use "_TintColor" as their color property. So you should do:

renderer.material.SetColor ("_TintColor", c));
more ▼

answered Dec 11 '09 at 10:06 AM

Aras gravatar image

Aras ♦♦
1.6k 7 26

(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:

x5086
x640
x507
x320
x275

asked: Dec 10 '09 at 08:16 PM

Seen: 2603 times

Last Updated: Dec 24 '10 at 06:10 AM