Change particle render material randomly.

Hi thank you for viewing this again :

First I have
var splatters = Material;

Then on collision it calls the following two lines…

splatMaterial = Random.Range(0,splatters.length);

Which works… untill I get to this… PS> The object list I drag for materials 0 - 5 all have a material set it does create this object and it has a child " particle system… I’ m lost…

I have this line of code

gameobject.GetComponentInChildren(ParticleRenderer).renderer.material = splatters[splatMaterial];

//Why Does this not work… it gives me ERROR :Object reference not set to an instance of an object " NULL "

//There is no null for this line of code game object would replaced with instantiate object I … never get null when use regular object with material…

Use gameObject.GetComponent(ParticleSystem).renderer.material = splatters[splatMaterial];