x


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];
    }   
}
more ▼

asked Dec 24 '10 at 09:48 AM

ina gravatar image

ina
3.4k 500 554 616

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

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);
more ▼

answered Dec 24 '10 at 03:18 PM

Eric5h5 gravatar image

Eric5h5
81.5k 42 133 529

so you can't do a global variable for multid?

Dec 25 '10 at 03:28 AM ina

Sure you can; not sure how that's related.

Dec 25 '10 at 05:45 PM Eric5h5
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x3571
x29

asked: Dec 24 '10 at 09:48 AM

Seen: 1416 times

Last Updated: Dec 24 '10 at 09:48 AM