Hello.
On the iPhone,
Why does this work:
tmp = modeSum1[0];
modeSum1[0] = tmp + 1.1;
But this
modeSum1[0] += 1.1;
gives me the
“Operator ‘+’ cannot be used with a left hand side of type ‘Object’ and a right hand side of type ‘float’.”
With thanks, Peter
tonyd
October 30, 2009, 4:15pm
2
Arrays and hashtables behave a bit “quirky” on the iPhone, due to the lack of dynamic typing. It thinks your array contains objects rather than floats.
Try this:
var modeSum1 : float[];
modeSum1 = Array(1.0, 2.0, 3.0);
modeSum1[0] += 1.1;
Excellent. Thanks for that.
I was misinterpreting the error message and didn’t realise that Unity thought Object was an element of the array.
Regards, Peter