- Home /
Multidimensional JS Array System.Int32 not found
When using the .cs below to declare and populate multidimensional javascript arrays, I get this error:
MissingFieldException: Field 'System.Int32[,,].' not found.
http://www.unifycommunity.com/wiki/index.php?title=JavascriptMultiDimArrays
Here's a brief js that declares and populates one entry:
var multid; multid=MultiDim.IntArray(10,10,10); multid[0,3,5]=1;
Here is my .cs:
using UnityEngine;
public class MultiDim : MonoBehaviour { public static bool[,,] BoolArray (int a, int b, int c) { return new bool[a,b,c]; } public static int[,,] IntArray (int a, int b, int c) { return new int[a,b,c]; }
}
Answer by Eric5h5 · Dec 24, 2010 at 03:18 PM
The point of using MultiDim, as described in the documentation, is that the variable is typed correctly using type inference, so doing
var multid;
is wrong, because that's dynamic typing. It needs to be
var multid = MultiDim.IntArray(10,10,10);