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 fffMalzbier · Oct 11, 2012 at 04:33 PM · guieditorarraysortextend

Extend Unity ObjectField / Array function/Gui interface

I like to extend the Unity Editor GUI to make a universal sort function for all Arrays available via Context menu.

Is there a way to extend the ObjectField class or the the class that is controlling the GUI for arrays?

Example:

X different Classes with Arras of different types.

I like to sort the input objects (like a image sequence or data files). Implementing / copping the code for sorting in every time in a new custom editor class is not very efficent.

Comment
Add comment · Show 3
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 kmeboe · Oct 11, 2012 at 04:36 PM 0
Share

Can you give an example of what you're talking about? You want to somehow sort all arrays in your scene? As in reorder their elements?

avatar image fffMalzbier · Oct 11, 2012 at 05:42 PM 0
Share

Updated the post.

avatar image kmeboe · Oct 11, 2012 at 05:51 PM 0
Share

C# has built-in array sorting: http://www.csharp-examples.net/sort-array/

Hope this helps.

1 Reply

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

Answer by JRule4 · Oct 11, 2012 at 05:50 PM

You can only write CustomEditors for classes that are derived from Component. Arrays are not, so you can't write a generic inspector for them.

You could write an EditorWindow that uses reflection to look up any arrays in a target object. Once the arrays are located they can be modified. Sorting is something special, though, as it requires information on how a list of objects need to be sorted.

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 fffMalzbier · Dec 21, 2012 at 11:02 AM 0
Share

Thanks but the idea was to make a universal function for all public visable arays in any calss.

avatar image shinriyo_twitter · Nov 12, 2015 at 12:25 PM 0
Share

How about my answer in there?

http://50.17.205.126/questions/780158/problem-using-editorguilayoutobjectfield-with-cust.html

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

12 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Changes not being saved in the Inspector Editor 1 Answer

EditorGUILayout.ObjectField for Array 1 Answer

sort gui button 0 Answers

Split Unity editor to work with extended displays? 0 Answers

Filling GUI.BeginScrollView with images 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