This post highlights the danger of “too much stuff on one line.”
This warning:
is completely unrelated to runtime or getting variables.
The warning is about the .startLifetime
on ParticleSystem and has nothing to do with how you got the ParticleSystem.
The warning does not care HOW you got that ParticleSystem reference.
Read the warning carefully and it gives you the replacement method, transacting against the main
module of the ParticleSystem. Review the docs there, might even be example code.
Generally speaking, if you have more than one or two dots (.) in a single statement, you’re just being mean to yourself.
Putting lots of code on one line DOES NOT make it any faster. That’s not how compiled code works.
The longer your lines of code are, the harder they will be for you to understand them.
How to break down hairy lines of code:
http://plbm.com/?p=248
Break it up, practice social distancing in your code, one thing per line please.
“Programming is hard enough without making it harder for ourselves.” - angrypenguin on Unity3D forums
“Combining a bunch of stuff into one line always feels satisfying, but it’s always a PITA to debug.” - StarManta on the Unity3D forums
If this is a prefab, you really should make a small adaptor class at the root of it and drag the ParticleSystem in there, such that if you change stuff around, like add a second ParticleSystem into the hierarchy below this somewhere, it doesn’t magically and mysteriously break.