In Unity manual we are told to set properties like this
ParticleSystem ps = GetComponent<ParticleSystem>();
var main = ps.main;
main.startDelay = 5.0f;
And I cannot understand, why it works, as main
and startDelay
are value types.
Does this means, that main
have complicated setters with links to ParticleSystem
object? What are the profits of a such approach?
Now I cannot do ps.main.startDelay = 5.0f;
, but essentialy splitting "error" gives me no error.
I recreate naive environment, to check if I understand c# value type correctly. If You have a struct in a class, you cannot change struct properties like this. It has no effects!