In unity, when I try to do the following;
gameObject1.GetComponent<ParticleSystem>().main.startSize = transform.localScale.x / 5;
It says;
Cannot change the return value of "ParticleSyste.main" because it is not a variable.
But if I try to do the following;
var particleSystemMain = gameObject1.GetComponent<ParticleSystem>().main;
particleSystemMain.startSize = transform.localScale.x / 5;
it works. Why cannot I directly modify a propert's property?
Also, Unity documentation does this in the second way: https://docs.unity3d.com/ScriptReference/ParticleSystem.MainModule-startSize.html