Scripting with Shuriken - Getting module values?

I’ve asked this before, but I’m going to ask this again because it’s something I really want. I was waiting to see if Unity4 would address this, and it hasn’t (so far).

With a Shuriken particle system in script, I’m using particleSystem.getParticles to get an array of particles containing their position in space, their current size, color, etc.

The problem is that getParticles is not taking into account the modules settings. For example, if I set the emitter to have a Size over Lifetime curve, the particles in the array do not reflect that size-change; only what is set in the initial settings.

This makes getParticles functionally useless with any interesting-looking emitter.

I need a solution that either has getParticles returning accurate data (preferred), or some way of retrieving the module’s curve values so I can figure out what each particle’s value should be myself.

Using 3.5 I tried to see if I could figure it out but I can’t even get the particles into an array (there’s no return, ref or out param).

Have you been able to extract particles using 3.5?

Yeah, I can extract particles with 3.5.
You need to make an array ahead of time, pre-sized to roughly the maximum amount of particles. ( I estimate this as targetParticleSystem.emissionRate * targetParticleSystem.startLifetime * (a fudge factor, in my case 1.25))
Since the array itself in C# is a reference, until will fill all the entries in with particle data, returning from the function how many entries were filled in.

The four modules that don’t get reflected in GetParticles, that I need to are
color over lifetime
color by speed
size over lifetime
size by speed

My current solution is probably going to be to attempt to capture these values/curves with the serializedObject class. Hopefully I’ll have some success!

Cheers.

I tried reflection to see if there were any hidden methods or variables that may have the right info but that’s a long shot considering the particles probably get filled when you call GetParticles.

public static class ReflectionExtensions
{
	
	const BindingFlags flags = BindingFlags.NonPublic | BindingFlags.Public | 
         BindingFlags.Instance | BindingFlags.Static | BindingFlags.FlattenHierarchy;
	
	public static void Analyse(this Type type)
	{
	
		string report = type.FullName + "\n";
	
		MemberInfo[] members = type.GetMembers(flags);
				
		foreach(MemberInfo m in members)
		{
			report += m.Name + "			" + m.DeclaringType + "			" + m.MemberType + "\n";
		}
		
		report += "\n\n\n\n";
		
		Debug.Log (report);
		
		type.BaseType.Analyse();
		
	}
	
}