set newIntensity to a default value at the beginning, before any "if"s or "elses".
frustratingly unity/c# treats a variable that's only set when it's nested in an "if" statement as undefined for error tracking even if an "if/else" makes setting the variable inevitable.
[edit] actually in this case your value could get through as null, but even if you fixed that the above would be true.
you need a value to get through even if both conditions are false.
↧