- Home /
Question by
kmouse · Dec 21, 2010 at 04:25 AM ·
errorstaticvarstatements
simple coding problem
i have some code
static var speedometre = 1;
function OnMouseDown(){ if (speedtest.speedometre == 1){ speedtest.speedometre = 3; transform.Rotate(180, 0, 0); } else{ speedtest.speedometre == 1; transform.Rotate(180, 0, 0); } }
But unity comes up with the error:
Expressions in statements must only be used for their side-effects.
What does this mean and how can i fix this error?
Comment
Best Answer
Answer by Mike 3 · Dec 21, 2010 at 05:01 AM
speedtest.speedometre == 1;
should either be
speedtest.speedometre = 1;
or
if (speedtest.speedometre == 1)
To clarify, $$anonymous$$ike means the speedtest.speedometre == 1 inside the else clause. (It can be misinterpreted as the test in the if-clause if you're in a hurry)