I have two objects, ObjectA with scriptA and ObjectB with scriptB.
scriptA has the following.
var array1 =new int[5,9];
var array2 =new int[1];
function Start(){
array1[0,0] = 2;
array2[0] = 3;
}
and scriptB has the following
var value1 :int;
var value2 :int;
function Start(){
value2=GameObject.Find("ObjectA").GetComponent("scriptA").array2[0];
value1=GameObject.Find("ObjectA").GetComponent("scriptA").array1[0,0];
}
value2 sets correctly at 3, but value1 gets the following error:
MissingFieldException: Field
'System.Int32[,].' not found.
It's better not to use strings with GetComponent (faster, plus you get compile-time errors instead of runtime errors), also using generics is a simple way to avoid dynamic typing, which for some reason causes problems with multi-dimensional arrays.
Is value1 supposed to be accessing a 2D array? If so, it wouldn't be an int (Up top at the initializing), I believe. So I'd guess the problem is you're making value1 and int, but it can't be an int, because it's holding 2 values from the array.... If that makes sense.