Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 Vifi · Jun 25, 2018 at 01:51 PM · uieditorwindowscrollvieweditorguiexpand

Find out default inspector height

Hi, i wonder if there is a way to calculate default inspector height? I am doing my own editor window where i am drawing my own smaller windows with GL. My problemy is that i want them to resize when content (default inspector of Scriptable Object) is expanded (like toggle list). Any ideas how can i achive that? Right now i am using scrollView but i really need them to resize. I wanted to get scrollView max height from its vector2 since i belive it is pixel size of hidden arena but i cannot find any acces to it.

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
0

Answer by hector_gutierrezc_tvj32015 · Jun 25, 2018 at 02:14 PM

you set the size of the inspector at the end, the best way is to every time you put a label or something like that you sum the line space it ocuped.

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 Vifi · Jun 26, 2018 at 07:45 AM 0
Share

So you are saying that i need to count every line and multiply it by line height? So now my problem is how to count it... I mean, i just use editor.drawDefaultInspector of ScriptableObject (SO). It should be prepared for a lot of different SO. I belive i cannot get into it and find out if it has a list, and if that list is expanded, and if items in this list are also expanded. So how that GUI.Windows works? I need same behaviour, when list is expanded i need my window space to expand so it can be viewed without lost and without scroll.

avatar image hectorux Vifi · Jun 26, 2018 at 10:30 AM 0
Share
 //Normal List Draw 
 list.drawElementCallback =
         (Rect rect, int index, bool isActive, bool isFocused) => {
             var element = list.serializedProperty.GetArrayElementAtIndex(index);
 
 
 //A for to make multiple labels of same things
 for (int e = 0; e < lcn[index].sizeArray; e++)
                             {
 //This set a Label for an scriptable object 
                                 Array[e] = (ScriptableObject)EditorGUI.ObjectField(new Rect(rect.x, rect.y + height, 120, EditorGUIUtility.singleLineHeight), Array[e], typeof(ScriptableObject), false);
                                 a=Array[e] as YourTypeScriptableObject;
                                                              
                                height += EditorGUIUtility.singleLineHeight + separation;
        //Every loop iteration, it sum another line height to the general height of the inspector
                             }
 //To change the height of every index on my list
 
 heightArray[index]= height;
 
 //Set the list of the gui to change it height, i pass index as a variable, 
  list.elementHeightCallback = (index) =>
         {
             Repaint();
 //just paint the GUI
            
             return heightArray[index];
         };
 }
 





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

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

Adjust the width/height of List property elements in the Inspector 1 Answer

Scroll view not resizing properly with dynamic content 0 Answers

Editor GUI Foldout header style customization 0 Answers

Custom Editor - Is there any way to detect whether the user is in Prefab editing mode? 1 Answer

UI Annoying bug 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