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 N1nja · May 20, 2010 at 02:54 AM · guiarrayinspector

GUI, Inspector has no control for Arrays?

Well, the default inspector I see has a control for Arrays, when I have "public int myInt;", the inspector knows it is an integer, and when drawing the object inspector, it displays an int-field control to handle that variable.. however, if I was to have an array like Object[] or List, the inspector can determine that it is an array, and draw the appropriate inspector, much like for integers, floats, and enumerators; However..

I cannot for the life of me figure out the control they used to ~inspect~ the arrays; D=

Any in-sight on this? I've actually made my own.. but it doesn't look the same as the built-in one, and I don't want people at all confused, so I am hoping someone has some info on how to use the array inspector that's built in.. thank you!

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 N1nja · May 20, 2010 at 03:03 AM 0
Share

I found this documentation on SerializedProperties, http://unity3d.com/support/documentation/ScriptReference/SerializedObject.html;

It does not appear to work like I was hoping for.. =[ So, I'm still uncertain here!

3 Replies

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

Answer by Molix · Jun 09, 2010 at 02:05 AM

EditorGUILayout.Foldout is a special toggle control that is the little arrow used in the array (and other group) controls. e.g.

bool expanded = false;

void OnInspectorGUI() { ... expanded = EditorGUILayout.Foldout( expanded, "My Array" ); if( expanded ) { // draw count and elements } }

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 Eye_of_Triad · Jul 10, 2017 at 11:56 PM 0
Share

Does this mean that the only way to do it is manually? (e.g. the inspector won't do this automatically? Even if it shows the object's fields correctly when not in an array?) Thanks for posting.

avatar image
1
Best Answer

Answer by qJake · Jun 08, 2010 at 10:25 PM

If you combine EditorGUILayout.BeginToggleGroup(...) (and, subsequently, EndToggleGroup(...)) and an array of EditorGUILayout.ObjectField(...)'s (or whatever the type of the Array is), you should get the effect you're looking for.

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
0

Answer by steinbitglis · Feb 24, 2012 at 02:02 PM

If you want to do this like DrawDefaultInspector(), look at my answer to this question.

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 Eye_of_Triad · Jul 10, 2017 at 11:49 PM 0
Share

The link is broken.

avatar image steinbitglis · Jul 11, 2017 at 07:29 AM 0
Share

You can try this, or this.

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

2 People are following this question.

avatar image avatar image

Related Questions

How to show an array of custom objects in Inspector? 2 Answers

array inspector reordering 8 Answers

How to know if something is selected in Hierarchy or in project. 5 Answers

[INSPECTOR ARRAY] Replace 'Element 0' by 'Map 0' with auto increase 0 Answers

Dynamic Target for Object field (and others) in Custom Inspector 0 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