Hi,
I am slightly confused with local copies and copying by reference. Here is my setup:
public class minimal : MonoBehaviour
{
private Particle[] particles;
void Start()
{
particleEmitter.Emit(iterations);
particles = particleEmitter.particles; // (*1*)
particleEmitter.particles[i].color = Color.red; // (*2*)
// does not have an effect (for some i). Instead, however,
particles[i].color = Color.red; // (*3*)
// does draw the particle as red.
}
}
I would expect that (1) is a local copy. But judging by the result of (3), it looks like it is actually a copy of the reference addresses in the memory. I am also surprised why you cannot access the component directly, as in (2). Could someone explain this?