• 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
4
Question by baha · Apr 02, 2010 at 08:02 AM · inspector

Customizing the Inspector (Array handling)

I'am customizing the inspector for one of my scripts which can't be handled by the default inspector and there is a class with nested array of the same type, i don't want know how i can handle arrays using my own code because down the hierarchy there is a class with custom code depending on an enum value, the EditorGUILayout.PropertyField () seems not to be helpful in this cause or i may be not understanding it well, Any solutions?

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

3 Replies

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

Answer by markS · Jun 21, 2012 at 02:26 PM

I find that if you call...

  EditorGUILayout.PropertyField(serializedProp, true);

...it works for arrays. The bool value is the includeChildren parameter.

Comment
Add comment · Show 1 · 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 weven.k · Jun 06, 2014 at 01:21 AM 0
Share

I can't give this a thumbs up, but I believe this is the answer, works for me.

avatar image
1

Answer by baha · Apr 02, 2010 at 12:35 PM

The only visible solution to this case i have found until now is to create a recursive function that draws the required content in the inspector and controls the array items by firstly creating a javacript array and modify its length then converting it to the builtin array with the required type.

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
avatar image
-1

Answer by qJake · Apr 02, 2010 at 09:09 AM

This page gives an overview of how you can create your own "Inspectors" from code. Note, that the Unity editor is completely scriptable in and of itself, as well.

http://unity3d.com/support/documentation/ScriptReference/Editor.html

Comment
Add comment · Show 2 · 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 baha · Apr 02, 2010 at 10:57 AM 0
Share

I know this and i'am using it, this is not what i'am looking for and that is the reason why i asked the question on unity answers, i already walked around the whole documentation and reference but i was looking for a fast solution but i had to develop one by my own using a recursive function however thanks for the help and i'am very great-full for your support :)

avatar image AngryAnt ♦♦ · Jun 21, 2010 at 09:33 AM 0
Share

By loginmightytron (moved from answer to comment): I have the same problem. EditorGUILayout.PropertyField doesn't seem to work for array types. First I thought it might be because I forgot to use the [System.Serializable] Attribute on my class, but it doesn't work for int[] either...

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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

2 People are following this question.

avatar image avatar image

Related Questions

Gameobject rotating weird 0 Answers

Assigning animations in inspector? 1 Answer

The box for entering a variable's value in the inspector is not where it should be. 0 Answers

Hotkey for scrolling through different shaders in inspector? 0 Answers

Drag a bunch of scene items into an array all at once? 1 Answer


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