Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by nonlin · Aug 05, 2014 at 04:40 PM · javascriptinspectorserialize

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 http://docs.unity3d.com/ScriptReference/Serializable.html for tips.

Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image meat5000 ♦ · Aug 05, 2014 at 04:42 PM 0
Share

The only difference I see in the example is that the variables are all initialised.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by nonlin · Aug 05, 2014 at 06:12 PM

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!

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

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

Answers Answers and Comments

3 People are following this question.

avatar image avatar image avatar image

Related Questions

Variables Won't Appear In Inspector 1 Answer

Javascript and C#, different behaviour in inspector ? 1 Answer

Add elements to array/list in inspector? 1 Answer

How can I access this class from another script? 1 Answer

Can someone help me fix my Javascript for Flickering Light? 6 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges