Before updating to Windows 10 you may need to return your Pro license. More information here

Accessing data in an array of arrays

I have an array of arrays. I am wondering

 // why does this work 

Debug.Log("woodPriceArray[whichRes] = " + woodPriceArray[whichRes]);

Debug.Log("priceArrays[1][1] = " + priceArrays[1][1]);

// and not this, which is essentially the same thing ( n o t e : whichRes =1 )

var randVar : int = 1;

Debug.Log("LOOK HERE 1: " + quantityArray[whichRes][randVar]);

more ▼

asked May 02, 2012 at 11:54 AM

avatar image

11 16 12 13

woodPriceArray is set to quantityArray[1]

priceArrays[1][1] gives the same result as woodPriceArray[1]

May 02, 2012 at 11:56 AM littlemegzz
(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

I'm not sure if this is currently accurate, but I've had difficulty in the past, and never actually figured out back then, how to get multi-dimensional arrays working in javascript. They will definitely work with c# though..


turns out, as suspected my info was outdated.. here's a link that may start you down the right track:


looks like it's: QuantityArray[1,1]

more ▼

answered May 02, 2012 at 11:58 AM

avatar image

Seth Bergman
8.8k 34 40 74

ok, thanks for the quick reply. I dont know c# so that wont help me just now... hmmmm

May 02, 2012 at 11:59 AM littlemegzz

Does anyone else know whether this is just some unity javascript thing?

May 02, 2012 at 12:03 PM littlemegzz

see answer above, you would say it as: quantityArray[1,1] etc..

May 02, 2012 at 12:15 PM Seth Bergman
(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



Answers and Comments



asked: May 02, 2012 at 11:54 AM

Seen: 1281 times

Last Updated: May 02, 2012 at 11:31 PM