I'd like to keep a reference to a MinMaxCurve, a struct in some particle system module.
I need this ability to refer to any MinMaxCurve generically, rather than always dealing with the specific module and attribute.
Here's the gist:
public class ParticleAttributeMultiplier : ParticleAttributeAdjuster {
new private ParticleSystem particleSystem;
private ParticleSystem.EmissionModule emission;
private ParticleSystem.MinMaxCurve minMaxCurve;
public override void Start () {
particleSystem = GetComponent<ParticleSystem> ();
emission = particleSystem.emission;
minMaxCurve = emission.rateOverTime;
}
public override void Input (float intensity) {
minMaxCurve = 1000f;
}
}
This does not work because the emission and rateOverTime are both structs, returned by value:
public struct EmissionModule
{
// ...
public MinMaxCurve rateOverTime { get; set; } // also a struct
// ...
}
Is it possible, in any way, to store a reference to rateOverTime as a MinMaxCurve?
This seems to be the crux of the problem:
// "A property or indexer may not be passed as an out or ref parameter"
ref ParticleSystem.MinMaxCurve minMaxCurve = ref emission.rateOverTime;
Really appreciate any geniuses out there who can solve my problem.