I have been trying to get this work, it might be some minor stupid mistake, but I losing my nerves. I want to change tint color of particle material and here is what I have been trying:
function Update () {
var alpha : float;
var lightOn : Color = Color.white;
var lightOff : Color = Color.black;
var duration : float = 1.0;
var lerp : float = Mathf.PingPong (Time.time, duration) / duration;
var color : Color = Color.Lerp (lightOn, lightOff, lerp);
//
//
GetComponent(ParticleRenderer).material.SetColor("_TintColor", color);
//This gives error: NullReferenceException: Object reference not set to an instance of an object
}
I have material assigned to mesh, not particle, could it be a problem? If so, how to solve it. I’m doing pinball table and trying to make flashing lights with simple planes just over table and use addive material to give lightning effect.