- Home /
Anyone knows a good tutorial about JS Array class and how to use it?
I know basic things about Array class, but i got stuck often on things like what happen with index that stored game object that got destroyed.
edit: the slot that the game object got destroyed returns null. still i appreciate a good tutorial about Array class :P
thanks in advance.
Answer by Herman-Tulleken · Oct 20, 2010 at 02:34 PM
Also check out this article: http://robotduck.wordpress.com/2009/11/04/88/
Answer by Bravini · Oct 20, 2010 at 01:24 AM
The properties of a destroyed object become null cause they lose the reference and are cleaned on the next call of garbage collector. I hope these are of some use for you: http://www.unifycommunity.com/wiki/index.php?title=JavascriptMultiDimArrays
http://answers.unity3d.com/questions/7929/geting-the-closest-object-from-a-array
also for in depth knowledge of js I recommend the book Head First Javascript, it have a lot of content and an easy to catch language, you can find it cheap on amazon.com :]
thanks ill check the book. but is it the same in unity JS like in JS? http://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_splice for instance in this example there is a splice function that don't exist in unity JS Array (or i cant find it). and it is a nice function :D i did some function to do the same by creating temporary Array to hold the second part, then add the element at the end, and then add the temp array at the end off the original array. but i think splice is a lot better solution then my noobish function.in other words a unity JS array tutorial will be appreciated.thanks
Your answer
![](https://koobas.hobune.stream/wayback/20220613080148im_/https://answers.unity.com/themes/thub/images/avi.jpg)