particle system controll is wierd

This

  ParticleSystem.EmissionModule em = _particleSystem.emission;
        em.rateOverTime = _initialEmission * intensity;

shows me error:

: Do not create your own module instances, get them from a ParticleSystem instance

almost the same code is in a scripting reference. And even more. Almost the same code in other place in my project works perfectly well.

What is wrong? How can I fix it?

This is just a bog standard null reference. The steps to fix it area always the same, ALWAYS.

How to fix a NullReferenceException error

https://forum.unity.com/threads/how-to-fix-a-nullreferenceexception-error.1230297/

Three steps to success:

  • Identify what is null
  • Identify why it is null
  • Fix that

I’ve just noticed NRE… my fault

1 Like