- Home /
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!
Answer by Aras · Dec 11, 2009 at 10:06 AM
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));
Your answer
Follow this Question
Related Questions
Changing two different objects renderer colour 1 Answer
Material doesn't have a color property '_Color' 4 Answers
Renderer and Color are unknown to unity. Why? 1 Answer
The name 'Joystick' does not denote a valid type ('not found') 2 Answers
Particle System Sorting Layer Refuses To Be Assigned 1 Answer