Is this a Unity bug?

Didn’t know where to ask, so I’ll just put it here.

This simple code works, but Debug Logger reports an error. Why?

var number = 1;
var number2;

function Update () {
number ++;
number2 = number *=;
Debug.Log(number2);
}
number2 = number *=;

Fix that.

this is not correct:

number2 = number *=;

you can do the following:

number2 = number2 * number;

//or

number2 *= number;

It is easy to fix it but if it is an error, why does it work?

Yes,

number2 *= number;

this is much more elegant solution.

Thx!

I think unity ignores a line if it’s wrong. It reports the error and keeps going

if a line is wrong compilation will not work for any script.

if a line causes an exception the rest of the function / codeflow of that call is terminated by mono