Hey Guys!
I just updated to 5.4 and sometimes I get this strange error on my particle system:
NullReferenceException: Do not create your own module instances, get them from a ParticleSystem instance
UnityEngine.ParticleSystem+EmissionModule.set_enabled (Boolean value) (at C:/buildslave/unity/build/artifacts/generated/common/modules/ParticleSystem/ParticleSystemBindings.gen.cs:362)
This is caused by the following lines of code:
if (_smokeParticles == null)
{
_smokeParticles = new List<ParticleSystem>();
_smokeParticles.Add(_rearLeftWheel.GetComponentInChildren<ParticleSystem>());
_smokeParticles.Add(_rearRightWheel.GetComponentInChildren<ParticleSystem>());
}
foreach (var smoke in _smokeParticles)
{
var emision = smoke.emission;
emision.enabled = value;
}
}
emision.enabled = values is the thing that actually throws the error.
Things to note:
The error is not thrown every time I call the respective function
This never happens before 5.4