- Home /
Slicing error on "builtin" arrays?
here's my code:
var serial = int[800];
later in the code, I have one reference to this arrray:
serial[counter] = int.Parse(line.Substring(7,5));
here's the error I get:
Assets/MasterGO.js(21,9):BCE0048:Type 'System.Type' does not support slicing.
It looks like I'm doing things according to what I read in the unity wiki.
Answer by Mike 3 · Jul 05, 2010 at 12:25 PM
the problem you have is that you've declared your array line wrong (And I'm going to fix the wiki, it's wrong there too)
var serial int[800];
should be
var serial = new int[800];
Yup. I got it fixed in my code. Thanks for updating the wiki. I was searching all over the rest of my code. ;)
Answer by montblack · Aug 03, 2010 at 06:26 AM
i have another problem i do something like this:
var enemies = new myClassName[0];
in the inspector works great but i want to add a new object to the builtin array directly from my .js code how i can do that? i tried this:
enemies.Push(new myClassName()); -> error enemies.Add(new myClassName()); -> error enemies= new myClassName(); -> error enemies[i] = new myClassName() -> i is the last index + 1 (error)
(and sorry for my english i speak spanish)
You should start a new question for that. Answers aren't the place for asking questions.