- Home /
Array Not Appering In The Inspector
In my code I have:
#pragma strict
var Enabled : boolean;
var BackgroundTexture : Texture;
var Items : Array[];
And here is what I see in the inspector:
Why don't I see the array in the inspector? And why can't I use RemoveAt?
You don't want to use the Array class. Use built-in arrays or generic Lists ins$$anonymous$$d.
I have typed:
var Items : Array;
And it still wont show in the inspector.
How would you write an array variable? I think I am forgetting how.
As I mentioned, don't use Array, use built-in arrays or generic Lists. Array will not show in the inspector, and has other problems such as being untyped, kind of slow, and the functions available for it are somewhat limited.
Answer by Sisso · Aug 12, 2013 at 11:23 PM
Inspector only works for unity and basic types. If you want something more complex you must do in your own customizing the Inspector.
Exemple:
var numbers: int[] = [];
var targets: GameObject[] = [];
class MyData {
var numbers: int[] = [];
var targets: GameObject[] = [];
}
var data: MyData[] = [];
I didn't mean to put [] after array once I removed it, it fixed it.
Answer by Eric5h5 · Aug 13, 2013 at 06:52 AM
Use a built-in array or a generic List rather than the JS Array class.
Your answer
Follow this Question
Related Questions
How to Manually write a 2 dimensional array in javascript 0 Answers
Assign Default For Large Array 1 Answer
Public 2D array, accessed through the editor ?? 3 Answers
For values in array 2 Answers