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
1
Question by thrmotta · Mar 26, 2015 at 07:20 PM · c#serializedpropertyscrollbarcustomeditorpropertyfield

Horizontal Scrollbar shows up when Vertical Scrollbar appears

Hello!

Im currently working on a project where I need to do an extensive remake on some classes, so Im using CustomEditors in order to give the best interface possible to my scripts. So far this is doing good but one thing is really annoying me. Everytime I have a script thats needs vertical scrolling, then a horizontal scrollbar will also pop up! It seems to me that since the vertical scrollbar takes some space to be drawn, then the editor adds a horizontal bar to make up for the lost space. I find this behaviour to be errouneous, as Id expect the interface to shrink a bit in order for the vertical scrollbar to fit in, which does not happen.

How can I fix this?

In my interface, most fields are composed by a EditorGUILayout.PropertyField with a Name, a Tooltip and a LabelField on the same horizontal space, as seen on the Max Effort field on the following picture

alt text

But as soon as I open up the two other foldouts, which makes the GO inspector be vertically bigger than the screen, this happens:

alt text

This is the code that I use to draw most variables on the editor:

 EditorGUILayout.BeginHorizontal (GUILayout.ExpandWidth(false));
 EditorGUILayout.PropertyField ( field.getProperty(), 
                                 new GUIContent ( field.getName(), field.getTooltip() ), 
                                 true );
 EditorGUILayout.LabelField( field.getUnit() );
 EditorGUILayout.EndHorizontal ();


How can I fix this? Thanks!

thrustersinterfaceproblem.jpg (43.3 kB)
thrustersinterface.jpg (22.0 kB)
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

2 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by frogtamer · May 19, 2015 at 02:31 PM

I also had this problem, but found that using GUILayout rather than EditorGUILayout fixed it.

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 tswalk · Mar 26, 2015 at 09:26 PM

I'm just guessing that you're using EditorGUILayout.BeginScrollView(...) ?

Does it fail with forcing alwaysShowHorizontal to false?

You can mix in either GUI.VerticalScrollbar or GUILayout.VerticalScrollbar, but you'll need to calculate and translate stuff on your own.

.. if I recall, EditorGUILayout scrollviews are... pretty buggy.

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 thrmotta · Mar 27, 2015 at 06:13 PM 0
Share

To be honest Im not really using BeginScrollView. The scrolls shows up relative to the whole inspector, not just for a single component. Im uploading a picture taken from the full Inspector interface, which for this sample have two components, but it can be more. So im not using any kind of scroll control right now, ill try the alwaysShowHorizontal in a $$anonymous$$ute and will reply back here

![alt text][1]

interfacescrollproblem.png (68.4 kB)
interfacescrollproblem.png (68.4 kB)

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

22 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

Related Questions

Editor Targets are updated but SerializedPropertys arent 1 Answer

Multiple Cars not working 1 Answer

Distribute terrain in zones 3 Answers

Invalid iteration - (You need to stop calling Next when it returns false) 2 Answers

Creating a custom inspector utilizing a list of class instances with serialization? 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