This is a truly strange one!
Before I go any further, it is important to note that the type of array you are using is not native to JS. It's actually a Unity3D tack-on! (From C# .NET, SEE: [http://msdn.microsoft.com/en-us/library/2yd9wwz4.aspx][1] ) So, right here you may be running into issues.
This stated, it may be possible that that type of array simply does not support the += operation (It's hard to say, I've tried to stay away from using it). You may want to try float[][], as opposed to float[,]
Assuming this is not true, it seems to be treating your + and your = as seperate operators.
Try: infastructure[1,i] += desire[i]*popChange; (note that the += is surrounded by spaces)
To further specify to the compiler that you are NOT using + separately from the =, you could try
(infastructure[1,i]) += (desire[i]*popChange); This isolates the += from either of your statements.
Honestly, I have never played with this type of array, so it is all speculation.
Other alternatives you could consider are:
var arr = new Array();
arr.push(new Array());
Now, this next one is tricky, and I have no idea if it will work. I've long dropped JS for C#, but theoretically it could work:
var arr : ArrayList = new ArrayList;
You will want to import System.Collections for this to work!
[1]: http://msdn.microsoft.com/en-us/library/2yd9wwz4.aspx
↧