Javascript Serializable Types not showing in inspector

I have the following code.

class Test extends System.Object {

public var itemName = "";
public var itemID : int;
public var itemDesc = "";
public var itemIcon : Texture2D;
public var power : int;
public var speed : int;
public enum itemType { Empty, Torso, Pants, Equipable, Consumable };
public var test = Test ();

in a file called Item.js

Then in another file called ItemDatabase.js

I make a list of Item

#pragma strict
import System.Collections.Generic;

var items : List. < Item > ;//Type cast
items = new List.

However, in the inspector, I set the list to 5 and I don’t see any sub options for the other variables.

What am I doing wrong?

I looked at at Unity - Scripting API: Serializable for tips.

I figured it out. The example just uses a generic class named test but I had to change test to Item. So simple it was right under my nose…

For future people, make sure your class name matches your .js file!

EDIT: However, it seems as though my enum menu no longer shows all other variables show in inspector and I’m getting the error

StackOverflowException: The requested operation caused a stack overflow.
Item…ctor () (at Assets/Item.js:13)
Item…ctor () (at Assets/Item.js:13)
Item…ctor () (at Assets/Item.js:13)
Item…ctor () (at Assets/Item.js:13)

Sooo close!

EDIT: Solved that too, just had to declare a new var of itemType.

I’m good!