- Home /
Particle system MinMaxCurve problem
I have a specifc problem with particle system , I'm controlling the particle system via script , the problem comes up when I try to edit any MinMaxCurve in any module as shown below :
using System.Collections;
using UnityEngine;
[RequireComponent(typeof(ParticleSystem))]
public class PSTest : MonoBehaviour {
ParticleSystem MyPS ;
void Start () {
MyPS = gameObject.GetComponent<ParticleSystem>();
ParticleSystem.MainModule MyPSMain = MyPS.main;
AnimationCurve ACTemp = new AnimationCurve (new Keyframe[] {
new Keyframe (0, 1) , new Keyframe (1, 0) });
MyPSMain.startSize = new ParticleSystem.MinMaxCurve ( 1 , ACTemp );
}
}
when I try script in the editor it works fine and no exception is thrown but when I run the project on android device the application exit and stop working after some tests I found that this line is making the issue :
MyPSMain.startSize = new ParticleSystem.MinMaxCurve ( 1 , ACTemp );
So I try something else :
using System.Collections;
using UnityEngine;
[RequireComponent(typeof(ParticleSystem))]
public class PSTest : MonoBehaviour {
ParticleSystem MyPS ;
void Start () {
MyPS = gameObject.GetComponent<ParticleSystem>();
ParticleSystem.MainModule MyPSMain = MyPS.main;
AnimationCurve ACTemp = new AnimationCurve (new Keyframe[] {
new Keyframe (0, 1) , new Keyframe (1, 0) });
ParticleSystem.MinMaxCurve SizeCurve = MyPSMain.startSize;
SizeCurve.curveMultiplier = 1;
SizeCurve.curve = ACTemp;
}
}
but what happens is the value of curve constant is working but the curve itself isnt assign to the start size , I though that I was taking value by reference when doing that , but when I debug I noticed that the start size have a value of null for both Min and Max Curve
Answer by richardkettlewell · Feb 27, 2018 at 10:23 AM
Hi, please report a bug for this issue, using the first script: https://unity3d.com/unity/qa/bug-reporting
Your answer
![](https://koobas.hobune.stream/wayback/20220612152454im_/https://answers.unity.com/themes/thub/images/avi.jpg)