There are many questions out there on how to access the ParticleSystem from script. For some reason, the modules inside the Shuriken ParticleSystem are completely hidden at runtime.
-
how to access Shuriken Particle System Modules in script - Questions & Answers - Unity Discussions
-
How Do I Access the Shuriken Velocity Over Lifetime in C# - Questions & Answers - Unity Discussions
-
How to modify ParticleSystem from Editor script? - Questions & Answers - Unity Discussions
As mentioned in that last topic by Idioismist
First question—Is this going to change? And when? Unity 5?
Second question—Are there workarounds?
Using SerializedObject I have found out that the property I need is e.g. ForceModule.x.maxCurve.m_Curve.Array.data[1].value.
However, setting this through SerializedObject is impossible at run time. My second attempt was to use Reflection, but the following code only returns getters and setters for the same public variables, the modules are left out for some reason.
foreach (PropertyInfo pi in particleSystem.GetType().GetProperties(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance))
{
Debug.Log( pi);
}
Where are the modules?!