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 unitydev0008 · Feb 27, 2011 at 06:46 AM · arrayinspectormonobehaviour

Display Non Monobehaviour array in inspector C#

Topic pretty much says it all, I have a Monobehaviour script with a array of a class i created that does not inherit from monobehaviour and the array is not showing up in the inspector.

Anyone know why or how to fix this?

Thanks in advanced

Comment
Add comment
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

1 Reply

· Add your reply
  • Sort: 
avatar image
6
Best Answer

Answer by Demigiant · Feb 27, 2011 at 08:42 AM

  1. Check that your Array is public and non-static.
  2. Place the [System.Serializable] attribute before the arrayed class declaration
  3. If your arrayed class inherits from Object, don't write it (that is: "public class MyClass:Object" is wrong, "public class MyClass" is right). Don't know exactly why, but I had the same issue, and finally realized that removing the Object inheritance made my class being serialized (I was using a List instead of an Array, but I suppose it's the same).

Sample serialized Class:

[System.Serializable]
public class MyClass
{
   // Class stuff
}
Comment
Add comment · Show 4 · 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
avatar image unitydev0008 · Feb 27, 2011 at 10:30 PM 0
Share

Thanks a ton for this! I did read about the System.Serialiable but i was putting it on the wrong script lol thanks again man!

avatar image Real Multimidias · Mar 15, 2013 at 01:29 PM 0
Share

Thank you, my mistake was the third step.

avatar image konsnos · Jun 26, 2014 at 11:46 AM 0
Share

3rd step was my solution too. Had a problem with Instantiate but seems to be a static function so no problem fixing that :)

avatar image Tsilliev · Jun 11, 2015 at 07:10 PM 0
Share

"PUBLIC" made the array showable at the inspector, ty

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

1 Person is following this question.

avatar image

Related Questions

How to place a non monobehaviour script into an array in inspector 1 Answer

Filling a large public array in editor 1 Answer

Array of abstract class in inspector 2 Answers

Custom Inspector & Arrays 0 Answers

How do I assign 3 variables to every GameObject in the array "enemy"? 2 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