"Expressions in statements must only be executed for their side effects." ERROR.

I'm getting an "Expressions in statements must only be executed for their side effects." error. What am I doing wrong?

It means you have a statement in your code that doesn't DO anything - it doesn't alter any state and thus doesn't have any effect on anything. That is seen as an error.

One example of this could be if you have a line like this (where MyFunction is a function declared elsewhere):

function Update () {

In this code there is a statement which just states the reference to MyFunction but doesn't do anything with it. If you wanted to call the function, you should remember the paranthesis:

function Update () {

Now the code actually calls MyFunction, so it's not seen as a coding error anymore.

An additional example that's not a function missing brackets:

I've been stuck with this error for accidentally putting the statements of a For loop in the wrong order. Due to the rarity of the traditional For(Intialisation;Condition;Increment) structure in my code, (and lack of syntax reference in the help file) this elementary error took a while to spot.

Placing my order as For(Intialisation;Increment;Condition), it tried to treat a condition as a change. Which is how I think I got this error.


this is the same error
must be